HSEROUT and 16F628A


Closed Thread
Results 1 to 2 of 2
  1. #1
    fredblah's Avatar
    fredblah Guest

    Default HSEROUT and 16F628A

    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

  2. #2
    d1camero's Avatar
    d1camero Guest


    Did you find this post helpful? Yes | No

    Default

    fredblah, I cannot see anything obvious, although I am not expert. I would try simply using SEROUT2 or DEBUG on a pin directly to the RS-232 (use inverted 2400 8N1). I have done this with a few chips and works well for me.

    Once I have that working, then I would move on to the UART, then to the MAX232.

    Caution: I am only hooking the uProc pin to the Rx pin on the PC, do not hook the Tx from the RS-232 without some kind of resistor as the TTL level could fry some parts.

    d1

    P.S. also double check you resonator value.

Similar Threads

  1. HSEROUT and Commas, What? Help Me Understand
    By altech6983 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 20th July 2009, 19:12
  2. hserout VS serout
    By johnson in forum General
    Replies: 2
    Last Post: - 3rd August 2004, 19:50

Members who have read this thread : 1

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts