Trouble Receiving Serial on PIC16F690
+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005

    Default Trouble Receiving Serial on PIC16F690


    I’ve been stumped with a problem for the last two days. I am using a PIC16F690 and trying to do serial communication with it. I am able to successfully send serial out using both HSEROUT and SEROUT, but I cannot get either HSERIN or SERIN to work. I have checked the logic level of my USB to serial adapter using my oscilloscope and it is sending 5V levels into the designated RX pin, but no matter what I try it does not accept any serial characters. I’ve tried various baud rates and T vs N (when I was trying to see if I had more luck with SERIN over HSERIN) just in case; no luck. I’ve also tried the same code (using only the SERIN command) on a PIC16F1507; again, SEROUT works but not SERIN.

    I studied the data sheets for these parts and I can’t find anything that I have missed… is there some peculiarity about these chips that I may have missed?

    I pasted below one of the HSERIN tests I tried with the F690, based on ME Labs' HSERIN/HSEROUT demo code. In this particular version I commented out their DEFINE HSER_RCSTA 90h and set the SPEN & CREN bits explicitly, just in case. But even without the explicit commands to set those bits and leaving the DEFINE HSER_RCSTA 90h alone as per the example, the serial receiving still doesn’t work. It does send the “Hello World” correctly.

    Any suggestions or tips would be very welcome!



    Include "modedefs.bas"
    DEFINE OSC 8 'define the clock speed so BASIC knows
    OSCCON = $FF

    ADCON1 = 7
    RCSTA.7 = 1 'SPEN = 1
    RCSTA.4 = 1 'CREN = 1
    TXSTA.4 = 0 'SYNC = 0

    ' Set receive register to receiver enabled
    ' Set transmit register to transmitter enabled
    ' Set baud rate

    char Var byte ' Storage for serial character

    Hserout ["Hello World", 13, 10] ' Send text followed by carriage return and linefeed
    low portc.5 ‘LED on
    pause 250
    high portc.5 ‘LED off

    Hserin 10000, start, [char] ' Get a char from serial port
    Hserout [char] ' Send char out serial port
    Goto mainloop ' Do it all over again


  2. #2
    Join Date
    Nov 2005
    Bombay, India

    Default Re: Trouble Receiving Serial on PIC16F690

    I think you need to set ANSEL=0 (reset value is $FF) to make all pins digital. ADCON1 on the 16F690 only sets the ADC conversion clock.

Similar Threads

  1. Replies: 2
    Last Post: - 27th February 2014, 23:27
  2. Receiving (Relatively) High Speed Serial Data
    By JEC in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd July 2012, 11:16
  3. Pic16f690 and basic Serial Com
    By ross246 in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 15th May 2010, 12:12
  4. Receiving and Transmitting Serial data at the same time
    By BobP in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 12th April 2007, 22:00
  5. Receiving data from more than one serial Port
    By PICtron in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 15th March 2005, 10:20

Members who have read this thread : 14

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