Only the last I/O line (PIN_A1) works! I tryed to drive one line per time and all is ok so the lines work. The result will be a square wave on each line.
All work fine but 1ms between lines is too long for my application. What is the problem? Is a bug or each line takes some time for commutation?
Best regards.
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
Posted: Fri May 06, 2005 2:46 pm
This is probably caused by the classic Read-Modify-Write problem.
The solution is to maintain a "shadow" register (a byte variable) in RAM
for all of your Port A pins. When you want to change the value of a
pin, you should change it in the Shadow register. Then write the
entire shadow register value to Port A in one operation. Don't do
individual bit set and clear operations.
Also, I'm assuming that you did everything else correctly on the 16F628,
such as disabling the comparators.
firefox78
Joined: 25 Jan 2005 Posts: 5
Posted: Sat May 07, 2005 3:40 am
Tank you very much. I will try your solution next week.
Best regards
fuzzy
Joined: 26 Feb 2005 Posts: 64
Posted: Sat May 07, 2005 4:15 pm
I had simlar problem with PIC16F876.
Port A is analog in this MCU so I had to specify, (NO_ANALOG) in ADC setup to have a digital Port. I don't know wether in your pic PORT a is analog .
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum