-----Ursprungligt meddelande----- Fr=E5n: piclist-bounces@mit.edu [mailto:piclist-bounces@mit.edu] F=F6r IVP Skickat: den 13 september 2015 12:21 Till: Microcontroller discussion list - Public. =C4mne: Re: [PIC]: Troubles with a 16f628a! > So what I should do is to use a variable to pack the bits in to and=20 > then send that variable to the port! Correct? It's the safest way on PICs without a LAT register, such as the 16s That should read "such as the old 16s". The best choice is to ditch the F628 and switch to one of the 16F1xxx models. Then you'll get RMW-safe LAT registers along with a much better architectur= e in general. Jan-Erik. =20 You might use a register called shadowa. Read the port into it, modify the contents, then write it back to the port Another page about r-m-w http://www.piclist.com/techref/readmodwrite.htm And what r-m-w can look like in practice. Part of a project that had me scratching my head for a while because what was coming out of the pins was the opposite of what I wanted http://web.archive.org/web/20041120185406/http://home.clear.net.nz/pages/jo= e colquitt/sx_pins2.html Joe=20 ----- No virus found in this message. Checked by AVG - www.avg.com Version: 2015.0.6125 / Virus Database: 4419/10628 - Release Date: 09/12/15 -- http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/chang= e your membership options at http://mailman.mit.edu/mailman/listinfo/piclist --=20 http://www.piclist.com/techref/piclist PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist .