PicBasic Pro PIC18LF45J10 Hserin2 problem


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Sep 2013
    Location
    Hobart Tasmania
    Posts
    2

    Default PicBasic Pro PIC18LF45J10 Hserin2 problem

    Hello all

    I am having problems reading a configurable serial port of a PIC 18LF. I am able to send data but unable to make sense of any of the data received. I have attached the cut down code I have been working on)

    Observations:
    1. The Define HSER2_BAUD instruction does not appear to set up the Pic's baud rate generator, I have to do this manually to get it working correctly.
    2. Once configured I am able to send a small test string "hello world" however it is proceeded by a zero. This is not too much of a problem, I am sure I can sort something out to resolve that issue.
    3. When I type a character to be received by the pic through an RS232 interface, the characters received are unintelligible.
    Things I have checked.
    1. I have checked using a scope that the RS232 driver is sending the data correctly to the pick. The letter "A" or any other character is observed to be arriving at the UART of the pic correctly and in the right phase (not inverted)
    2. I have sent the received data to an LCD to be displayed as well as sending the received character out to a terminal, in both circumstances the data is unintelligible.
    3. I have looked directly at the RCREG2 to ensure there was no problem there but what I see is the same unintelligible data.
    4. I have checked that I have the correct re-mappable pin for the UART. (The RX interrupt does not work if I select any other pin, in other words the UART is reacting to the data received)
    5. I have set BAUDCON2.3 = 1 to enable the UART to wake up from sleep mode, without this bit set, the UART does not wake up the PIC.
    I have spent some time on this now and I am clearly not getting anywhere. I am about to check UART1 operation to confirm if I have the same problem but as I have limited access to this port (it will be talking to another device) it’s a little more complicated. In the meantime if anyone could shed some light on the matter I would be very grateful.

    Cheers
    Ant
    Attached Files Attached Files

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,612


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Pro PIC18LF45J10 Hserin2 problem

    Hello,
    Have you checked the accuracy of the oscillator, perhaps it's too far off from 4MHz to accurately generate the baudrate timing? Also, have you checked the timing/baudrate of the sending device and verified that it is indeed as expected.

    Have you tried receiving without having the PIC in low power mode?

    /Henrik.

  3. #3
    Join Date
    Dec 2011
    Location
    IO93ok
    Posts
    190


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Pro PIC18LF45J10 Hserin2 problem

    You've set the chip sleep to Internal Oscillator at 4MHz but according to the datasheet this chip only has 31kHz oscillator available internally.

    I assume you are also using an external switched xtal.
    Last edited by tasmod; - 9th April 2014 at 08:11.
    Rob.

    The moment after you press "Post" is the moment you actually see the typso

  4. #4
    Join Date
    Sep 2013
    Location
    Hobart Tasmania
    Posts
    2


    Did you find this post helpful? Yes | No

    Default Re: PicBasic Pro PIC18LF45J10 Hserin2 problem

    Hello Rob and Henrik

    Thanks for your replies. old Murphy’s Law is still alive and well..! No sooner had I posted my thread I discovered my fault. Rob you are right on the money, I clean forgot that all the clocks on the processor are disabled while it is in sleep. Reading through the documentation, on the UART, I read that BAUDCON.1 allows the RX pin to operate as a change state interrupt and just assumed that the processor would wake up on the mark and would be alive and ready to read the data on the RX pin. Clearly this was not the case, I had not accounted for the oscillator start up time.

    Thanks for your input, I should have sent my post earlier, I would have got the help I needed sooner

Similar Threads

  1. PicBasic Pro Upgrade to 2.6 problem
    By dirtbiker5627 in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 18th May 2010, 03:22
  2. picbasic pro problem
    By Marin in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 12th April 2010, 14:31
  3. PicBasic Pro problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th March 2007, 22:22
  4. PicBasic Pro Math Problem??
    By Glen65 in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 5th March 2006, 04:36
  5. Math problem...with picbasic pro
    By pcaccia in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th October 2005, 19:28

Members who have read this thread : 0

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