PIC18F4550 to 18F4553 Comm Issue?


Closed Thread
Results 1 to 19 of 19

Hybrid View

  1. #1
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44

    Question PIC18F4550 to 18F4553 Comm Issue?

    I'm having trouble figuring this one out. I have code that works on my circuit board with a 4550, I changed to a 4553 so I could use a 12bit A/D. I moved the code that works with the 4550 to the 4553. Everything is working but I can't get the EUSART communication to work. It seems like it's not getting the interrupt, to trouble shoot I put an LCD message in the receive interrupt routine with a pause, the message is never displayed. I use DT interrupts for timers/clock and that part works, the RX_INT is in the same section, so I believe that should be OK. So my thought is there may be some difference in the DEFINES for the serial port baud rates etc. Trouble is the data sheet for the 4553 doesn't have a section for the EUSART so I can't put the data sheets side x side to compare. The data sheet for the 4553 is 46 pages, 4550 data sheet is 438 pages.

    Tomorrow I plan to solder some wires to the board so I can connect the serial to my PC to see if I can send/receive anything to my computer.

    For now I guess I have two questions, where is the complete data sheet for the 18F4553, and do you know if the serial defines I included would work on the 4553? These work just fine on the 18F4550.


    Code:
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive   
    DEFINE HSER_TXSTA 164 ' Enable brg, Enable transmit, BRGH = 1
    DEFINE HSER_SPBRG 10 ' 115200 Baud @ 20MHz, -1.36%  pg 245 spbrg vals
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    Thanks

  2. #2
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    http://www.microchip.com/wwwproducts/en/PIC18F4553

    At quick glance, they both use the same pins for EUSART, so that's a good thing.

    Check out this funky register on the 4553: DEVID1. EDIT: never mind, The Device ID registers are “read-only” registers

    Don't look for more pages in a 4553 datasheet, there are none:
    This document is supplemented by the “PIC18F2455/2550/4455/4550 Data Sheet”
    It is compatible with the 4550, so you're missing something very small if you already have it working between two 4550.

    Hmm, very dumb question: have you changed the model when you compile?

    Robert
    Last edited by Demon; - 13th April 2016 at 02:28.
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  3. #3
    Join Date
    May 2013
    Location
    australia
    Posts
    2,641


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    page 7 of the "46 page abridged version"

    Note:
    This data sheet documents only the
    devices’ features and specifications that are
    in addition to the features and specifications
    of the PIC18F2455/2550/4455/4550
    devices. For information on the features
    and specifications shared by
    the PIC18F2458/2553/4458/4553 and
    PIC18F2455/2550/4455/4550 devices,
    see
    the PIC18F2455/2550/4455/4550

  4. #4
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    to trouble shoot I put an LCD message in the receive interrupt routine with a pause, the message is never displayed.
    PAUSE within an interrupt aren't a good idea.

    Set a flag to 0,
    Set it within your routine,
    Then check it within your main program.

    What if you copy your programs for both pics down to bare EUSART code and try to get them talking?

    Are you sure it worked right before with two 4550?

    Uh, did you put the 4553 in backwards?

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  5. #5
    Join Date
    Apr 2009
    Location
    Boise, Id
    Posts
    44


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    Thanks for the responses, I can stop looking for the rest of the data sheet. I was too busy looking for fine print I overlooked the highlighted section that says it's the same as the 4550.

    I did get wires connected between the 4553 board and my PC. I put an HSEROUT in my main routine to send a message out once per second. All I get is qbert "«Š¥h” ejg«üa©Š¥Gh” ", I can move the wires to the 4550 board and the message displays fine.

    The 4553 isn't in backward (I've done that before, so it's the first thing I check now!). I also have an LCD and LED's that are driven from the 4553, those all work fine.

    I'll start a new program for the 4553 and just put in the bare EUSART as suggested. Hopefully I can find my error.

    Let me know if you have any other idea's.
    Thanks

  6. #6
    Join Date
    Jan 2005
    Location
    Montreal, Quebec, Canada
    Posts
    3,154


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    If your LED and LCD work fine on the 4553, then that PIC is working fine.

    If your 4550 can talk to another 4550, then that PIC is working fine.

    Are you using the right TX/RX pins on the 4553?

    There's really not a lot of possibilities here. The 4553 is EUSART compatible with a 4550. It is basically a 4550 with a different name.

    Do you use different wires?

    Do you do a simple drop-in substitution for the 4553, or do you have a separate breadboard circuit set up?

    What about a heartbeat LED?
    Main:
    LEDout = 0
    PAUSE 500
    LEDout = 1
    PAUSE 500
    GOTO Main
    END
    If you're using a separate circuit for the 4553, does this do a 1 second pulse?
    (I was thinking of a timing issue, LED and LCD might work fine, but EUSART would be more finicky)

    Just trying to eliminate all possibilities I can come up with.

    Robert
    My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.

    Not as dumb as yesterday, but stupider than tomorrow!

  7. #7
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: PIC18F4550 to 18F4553 Comm Issue?

    No expert, but these are things I look at when having issues with serial coms.

    Timing: The crystal and OSC value need to be right. On one project the code ran and the program functioned, but when communications was tested I got garbage streamed out to the PC. I then changed the xtal from 12mhz to a 10mhz and it worked fine.

    Try something like this with a 10mhz crystal fitted

    Code:
    DEFINE  OSC 20                          ' 18F4520, 10mhz crystal
    ADCON1 = $0F
    clear 
    
     ;----[UART Settings]------------------------------------------------------------
    
    DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
    DEFINE HSER_TXSTA 24h ' Enable transmit, BRGH = 1
    DEFINE HSER_CLROERR 1 ' Clear overflow automatically
    DEFINE HSER_SPBRG 8   ' 9600 Baud @ SPBRGH = 2
    BAUDCON.3 = 1         ' Enable 16 bit baudrate generator
    
    
    RCSTA = $90   ' Enable serial port & continuous receive
    TXSTA = $24   ' Enable transmit, BRGH = 1
    SPBRG = 8     ' 9600 Baud @ -0.03%
    SPBRGH = 2
    BAUDCON.3 = 1 ' Enable 16 bit baudrate generator
    
    
    RCIF                VAR PIR1.5                    ' USART receive flag
    Char                VAR BYTE                      ' USART byte received
    GIE                 VAR INTCON.7
    Then try your HSEROUT routine

    There was a useful calculator that worked out the settings based on the timings which might help http://www.picbasic.co.uk/forum/showthread.php?t=4994

Similar Threads

  1. RS232 comm
    By longdw in forum Serial
    Replies: 9
    Last Post: - 15th September 2009, 03:13
  2. trade 18F4553-I/P (really want 16c717/JW)
    By nomad in forum Adverts
    Replies: 2
    Last Post: - 1st November 2008, 22:49
  3. Code Issue - select case or 'if' issue - not sure why
    By jamie_s in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 7th October 2007, 08:52
  4. serial comm problem
    By win_832001 in forum mel PIC BASIC Pro
    Replies: 16
    Last Post: - 29th June 2006, 13:57
  5. Serial comm Problems
    By Fossil in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 7th January 2004, 02:29

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