Hi Albert,
[email protected] wrote: > While working on 18f devices, I noticed that all pin definitions point > to LAT registers, e.g. > > (18f4550.jal) > var volatile bit pin_B5 shared at LATB : 5 > > While this works great for writing, it does not work for reading out a > pin (in stead you'll read back the latched port, set during the last > write action, and not the actual port value. > So a the current library files / examples that need reading a pin > value, where a logical library name is tied to a pin name, e.g. > > var volatile bit i2c_sda is pin_c4 > > will fail in the i2c library where a read is done on the i2c_data > variable > > Has anybody thought about these issues and how to deal with them? Some background info in case you missed that: I'm not a hardware expert, and I have little experience with 18Fs. For the device files I have followed advises and copied examples I found floating around (and improved these where I though appropriate). That doesn't guaranteee perfect device files, and many fixes and improvements did pass by. Suggestions for improvements are welcome, referrably with good arguments! As far as using LATx for reading 18F pins and ports: I think you are right that the LATx registers should not be used to read the actual state of pins. But as far as I can see the current device files have only 'get functions for the low and high nibbles of registers. So when you read a full PORT or pin you should get the actual value. I don't exacly remember(!) why I included the 'get functions for the low and high nibbles. It could be a 'dumb' copy of the 'get functions in the device files of the baseline and midrange PICs. I'll do some tests to see if we can do without these. But it would also help if you experiment yourself with modified device files and report your results. Regards, Rob. -- Rob Hamerling, Vianen, NL (http://www.robh.nl/) --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "jallib" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/jallib?hl=en -~----------~----~----~----~------~----~------~--~---
