jamesr
Newbie level 6
Hi,
Probably a simple question, but I have written a program to count in binary (i.e. output to LED's on PORTB) which is fairly simple and counts from 0 to 16. This works fine in simulation and when programmed onto a PIC16F877A running on a multi matrix eblocks device. I.e the LED's count up in binary.
I now have to change this to count to 255, which again should be straight forward. I have changed the counting code to go up to 255 and from looking at the values assigned to PORTB at 255, it is indeed b'11111111' . I am using MPLAB for the simulation and can observe the value 255 in the PORTB register. However when I deploy this code to the chip, it doesn't seem to light up the bit 6,7 LED's.
I have been told that in order to count up to the maximum (8 bits) that some additional setup/configuration is required for the PIC, but I am unable to find this information anywhere or not sure where to look, I have the data sheet but I'm not sure what config I should be looking for?
Does any one know or is aware of additional setup's that are required for counting to 255 with an 8 bit register on PORTB?
Thanks
James
Probably a simple question, but I have written a program to count in binary (i.e. output to LED's on PORTB) which is fairly simple and counts from 0 to 16. This works fine in simulation and when programmed onto a PIC16F877A running on a multi matrix eblocks device. I.e the LED's count up in binary.
I now have to change this to count to 255, which again should be straight forward. I have changed the counting code to go up to 255 and from looking at the values assigned to PORTB at 255, it is indeed b'11111111' . I am using MPLAB for the simulation and can observe the value 255 in the PORTB register. However when I deploy this code to the chip, it doesn't seem to light up the bit 6,7 LED's.
I have been told that in order to count up to the maximum (8 bits) that some additional setup/configuration is required for the PIC, but I am unable to find this information anywhere or not sure where to look, I have the data sheet but I'm not sure what config I should be looking for?
Does any one know or is aware of additional setup's that are required for counting to 255 with an 8 bit register on PORTB?
Thanks
James
Last edited: