Disregard the above thread! :-)
BTW, how can I delete a thread??
Disregard the above thread! :-)
BTW, how can I delete a thread??
Hi,
I don't think you can delete a thread and I don't think you should, but that's my personal thoughts of course.
Instead post what the problem was, how you found it and how you solved it. That way others can read about it and perhaps learn something - which is what a forum like this is all about.
Was it perhaps a R-M-W issue?
/Henrik.
Keep in mind
All of the new "Enhanced 12FXXXX and 16FXXXX" parts use the LATx register for changing the output state. Portx register for reading the input state.
Hi,
Lat is short for latch. I not a good communicator, so I can't explain it better than the data sheet. The main thing to understand is that on the older pic16's we used portx.x to read or write to a pin. This could lead to R-M-W problem that Henrik pointed out. On the new pic16fxxxx,pic12fxxxx, pic18, dspic, and pic32 we use Latx.x to change the output. Portx.x is used to read a port pin. So on the above code you provided.
This is how it should be, as someone pointed out in the other thread.Code:Low PORTA.1 Low PORTA.4 PORTA.1 = 1 pause 1000 PORTA.4 = 1 pause 1000 PORTA.4 = 0 PORTA.1 = 1
Here a similar threadCode:Low LATA.1 Low LATA.4 LATA.1 = 1 pause 1000 LATA.4 = 1 pause 1000 LATA.4 = 0 LATA.1 = 1
http://www.picbasic.co.uk/forum/showthread.php?t=15836
Hi,
Just to clarify, writing to the PORT registers still works on ALL devices. The thing is that newer devices can run much faster (64MHz) compared to older (20MHz) so the risk of running into RMW issues are bigger.
Using the LAT register (when available) for outputs is a good idea. However, I'm not entirely sure that using HIGH/LOW (or any high level pin/port command) on LAT works, actually I don't think it does, but I'd be happy to stand corrected on that.
/Henrik.
Bookmarks