As a newcomer to the micrcontroller world I thought I would get quicker results by using the melabs basic compiler (not reckoning on the quality of the documentation).
I also chose to use a 16F628A thinking that its harware UART might make life easier. I have read section 12 (among others) of the Datasheet for this device pretty thoroughly and have had a good look at the forum. I have also taken a look at the HSEROUT entry in one of the libraries but don't really have enough assembler yet to really come to grips with it (which is why I bought the melabs basic compiler).
I have breadboarded the 16F628A with a MAX232 and checked the circuit twice. In the idle state the voltages on the MAX232 R1in(3.3V) and TXout (-5.3V) look OK. TXout is wired to pin 2 of the serial port on a PC, RXin is wired to pin 3 and Signal Ground is wired to pin 5.
I compiled the following code and uploaded it to the 16F628A.
DEFINE OSC 10 'Using a 10MHz Xtal
DEFINE HSER_RCSTA 90h
DEFINE HSER_TXSTA 24h 'BRGH set for high baud
DEFINE HSER_BAUD 9600 'Doco says use this OR SPBRG
DEFINE HSER_CLROERR 1
LOOP:
HSEROUT ["B"]
GOTO LOOP
END
The result is gobblygook at the PC end. I have tried two serial ports listeners and Hyperterminal and the best I can get is gobblygook, though one of them reports a framing error. I have also tried quite a few variants of the listed code.
The serial port on the pc is definitely working fine as I have another PC successfully outputting strings for another project.
I reckon its time to ask for help before I burn up a lot more time. Hopefully someone will point out some really silly blunder or omission I am making and put me out of my misery.
Any help would be very gratefully received.
Regards,
fredblah
Bookmarks