Hi,
I've been a longtime lurker here and find this forum gives a lot of good advice for electronics and microcontrollers, and have even read through, and learned from, many of the tutorials from members.
With that said, here is my question. I've been programming PIC 18F452, and 18F458 chips for years now and recently I've started with 18F1220 as I needed a smaller package.
On the previous chips, when I wanted to set or clear port bits to light leds I had no problems. Now with the 1220 I am able to light the leds, but sometimes when I do, some or all previously lit LEDs turn off.
I generally do this as: bsf PORTA,2 for example. So if I did the following it would initially light LED,0 then 1, then when it lights LED,2, 0 and 1 turn off.
As I said, this hasn't happened with the 452 or 458. What I ended up doing for now was create a shadow of PORTA and then move the file to the port, and this seems to work, so I know it isn't a power issue.
I can keep doing this if need be but it adds some code that I don't think is necessary. I also thought about setting the LATA register to get around this, but I haven't tried yet.
Thanks,
Zed
I've been a longtime lurker here and find this forum gives a lot of good advice for electronics and microcontrollers, and have even read through, and learned from, many of the tutorials from members.
With that said, here is my question. I've been programming PIC 18F452, and 18F458 chips for years now and recently I've started with 18F1220 as I needed a smaller package.
On the previous chips, when I wanted to set or clear port bits to light leds I had no problems. Now with the 1220 I am able to light the leds, but sometimes when I do, some or all previously lit LEDs turn off.
I generally do this as: bsf PORTA,2 for example. So if I did the following it would initially light LED,0 then 1, then when it lights LED,2, 0 and 1 turn off.
Code:
bsf porta,0
bsf porta,1
bsf porta,2
As I said, this hasn't happened with the 452 or 458. What I ended up doing for now was create a shadow of PORTA and then move the file to the port, and this seems to work, so I know it isn't a power issue.
I can keep doing this if need be but it adds some code that I don't think is necessary. I also thought about setting the LATA register to get around this, but I haven't tried yet.
Thanks,
Zed