Gday,
I have been programming the 16F628A to control servo's, with instructions being received from a PC. I had mostly everything in working order, and then everything started to deteriorate.
I had SerIn and SerOut in almost perfect working order, with the only problem being the accuracy of all characters. Upon more testing, the quality of the transmissions from the PIC to the PC deteriated. For example, i was receiving the words "Declared Variables" from the PIC without any problems. Then I started receiving "Declared Var******", with the asterisks being random characters. I have now changed this to the alphabet for testing purposes.
As of now, the PC does not acknoweledge any communications from the PIC, as if the serial cable is unplugged.
I have stripped the program down to the basics, as shown below.
Code:
PORTA = 0
PORTB = 0
CMCON = 7 ' Set comparators off
include "modedefs.bas"
i var byte
light var PORTB.0
'Startup routine
high light
for i = 0 to 10
toggle light
pause 100
next i
low light
pause 1000
high light
serout PORTA.1,N300,["AbcdefghijklmnopqrstuvwxyZ",10] 'Output lots of data slowly
serout PORTA.1,N300,["AbcdefghijklmnopqrstuvwxyZ",10]
serout PORTA.1,N300,["AbcdefghijklmnopqrstuvwxyZ",10]
serout PORTA.1,N300,["AbcdefghijklmnopqrstuvwxyZ",10]
low light
pause 500
end
The LED flashes as expected, and the LED lights while the PIC is meant to be sending data to the serial port, slowly. Hyperterminal does not receive anything, and neither does my control program written in VB6.
PORTA.1 is connected to the RX pin of the PC's serial port, ground is connected to the PC's serial port too. I have checked this many times, changed pins, changed cables, changed ports and even changed PIC's.
I cannot see any problems with the code above, or the hardware used. The configuration bits i've set are 3F18.
What I can't work out is why the SerOut command WAS working initially, but is not working anymore.
Bookmarks