USART problems


Closed Thread
Results 1 to 40 of 48

Thread: USART problems

Hybrid View

  1. #1
    egberttheone's Avatar
    egberttheone Guest

    Default USART problems

    I'm experiencing problems with a project the goal is to receive a time information string from 1
    processor to the other.

    setup:

    16F628:

    using the onboard crystal (4mhz)

    DCF time decoder; code used for sending the data string to the other processor:

    Code:
    DEFINE HSER_TXSTA 20h 
    ' Set baud rate
    DEFINE HSER_BAUD 19200
    
    HSerout ["A", STR TimeDate\6]
    18F452:

    10MHZ crystal; osc settings PLL X 4 runs on 40mhz

    Code used to receive:

    Code:
    DEFINE OSC 40
    
    intcon = %11000000 ' enable global and Peripheral interrupt
    pie1.5 = 1 ' enable interrupt on usart receive
    pir1.5 = 0 ' clearing interrupt flags
    adcon1 = %00001110 ' setting all pin's to digital i/o pins
    
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_BAUD 19200
    DEFINE HSER_CLROERR 1 ' automatically clear error's on overflow
    
    ON INTERRUPT GoTo handle
    
    Disable ' interrupt handler
    Handle:
    
    HSerin 500,TimeOut,[WAIT("A"),STR TimeDate\6]
    DCFSignal = 1
    TimeDate(5) = TimeDate(5) + 1
    GoTo Perfect
    
    TimeOut:
    GoSub SecondLineLCD
    LCDOut "DCF Error"
    DCFSignal = 0
    
    Perfect:
    pir1.5 = 0 ' clearing interrupt flags
    pir1.3 = 0 ' clearing interrupt flags
    Resume
    Enable

    I think the receiving issue is a sync problem because if I run the processor @ 20mhz and set the
    define osc to 20 then it works fine. what am I doing wrong?

    I'm also experiencing problems with the read and write commands for the onboard eeprom it give's
    compiler error's; it doesn't give errors when I compile a program for a 16f877 using the old
    compiler; the new compiler does give error's I'm using the MPASM V03.70.

  2. #2
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    19200 baud @4MHZ... by the datasheet table 12-5 it's suppose to work. But i'll prefer to set USART in a different way.

    What about if you remove the

    DEFINE HSER_TXSTA 20h
    ' Set baud rate
    DEFINE HSER_BAUD 19200


    and you replace it by

    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h 'enable TXEN and BRGH=1
    DEFINE HSER_SPBRG 12

    these will give you 19231 baud +/-0.16% (depending the oscillator precision too)

    On the other side¸
    @40MHZ

    remove :

    DEFINE HSER_BAUD 19200

    change it to:
    DEFINE HSER_TXSTA 24h 'enable TXEN and BRGH=1
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_SPBRG 129

    this will also give you 1923x baud +/-0.16%

    Always remind SPBRG change with the clock speed. Have to check in the datasheet.

    For this speed of serial comm, i'll prefer use else than the internal oscillator. I'm a bit surprise that it can work @19200 baud with a simple 4MHZ crystal.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #3
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    I'm also experiencing problems with the read and write commands for the onboard eeprom it give's
    compiler error's; it doesn't give errors when I compile a program for a 16f877 using the old
    compiler; the new compiler does give error's I'm using the MPASM V03.70.
    New MPLAB version 3.90 can maybe solve the problem. Wich version of PBP are you using?

    I do a lot of 18F452 project as now and no problems with the WRITE/READ statement. Are you using some OPTION_REG statement with 18Fxxx ? in case... this is your problem. Some register of the 18Fxxx are different than the F877.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  4. #4
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Thumbs up

    now it seems to work, is there any log file or something where MPASMWIN will place the error's because it says the code contains error's but not what the problem is, it very annoying since my code is miles long

    thx for your help already! (the serial systeem still doesn't work it now seems to have problems with the interrupt)


    EDIT:

    I now use microcode studio, I first used codedesigner it did not send me the error message's now I have the error message's but don't know how to fix this problem it all appeared after a format c: so I think some thing is installed wrong can't figure out what. this are the message's it produce:

    18F452.inc 20 : Symbol not previously defined (_CONFIG1)
    18F452.inc 21 : Argument out of range (not a valid config address)
    18F452.inc 22 : Symbol not previously defined (_CONFIG2)
    18F452.inc 23 : Argument out of range (not a valid config address)
    18F452.inc 24 : Symbol not previously defined (_CONFIG3)
    18F452.inc 25 : Argument out of range (not a valid config address)
    18F452.inc 26 : Symbol not previously defined (_CONFIG4)
    18F452.inc 27 : Argument out of range (not a valid config address)

    and so on...
    Last edited by egberttheone; - 20th January 2005 at 20:26.

  5. #5
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    Kick. not anyone known about the compile errors ? i found this but no reply : http://list.picbasic.com/forum/messa...tml?1028408396

  6. #6
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Looks like your .inc file is corrupted or the MPASM .inc files directory and PBP directory are not include in your path.

    i attach my MPASM .inc file. let me know
    Attached Files Attached Files
    Last edited by mister_e; - 25th January 2005 at 01:07.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  7. #7
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    and this one goes to your PBP directory
    Attached Files Attached Files
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  8. #8
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    YOUR AWSOME! the .inc file from the PBP was corrupted, many thanks!

  9. #9
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Thumbs up

    Great to know everything is working now
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  10. #10
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    Originally posted by mister_e
    Great to know everything is working now
    well the compiler does; my interrupt doesn't work and i can't find out why.

    Code:
    DEFINE OSC 40
    DEFINE HSER_TXSTA 24h 'enable TXEN and BRGH=1
    DEFINE HSER_RCSTA 90h 
    DEFINE HSER_SPBRG 129
    
    intcon = %11000000 ' enable global and Peripheral interrupt
    pie1.5 = 1 ' enable interrupt on usart receive
    pir1.5 = 0 ' clearing interrupt flags
    adcon1 = %00001110 ' setting all pin's to digitall i/o pins
    
    teller var byte
    
    on interrupt GoTo handle
    
    main:
    
    lcdout dec(teller)
    
    goto main
    
    
    
    Disable ' interrupt handler
    Handle:
    
    Teller = Teller + 1
    
    pir1.5 = 0 ' clearing interrupt flags
    Resume
    Enable
    I made my code as easy as possible to debug, if I send a serial signal to it it doesn't jump to the interrupt handler and ingreas teller by 1

  11. #11
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    quick idea here before i give it a look to datasheet. What about if you change you mainloop like this

    Code:
    main:
    
         If teller then
              LCDOUT $FE,1,"i had interruption"
              teller=0
         endif
    
         goto main
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  12. #12
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    hmmm i don't think its gone help because it doesn't increas @ all and if you say "if teller then" that means that teller has to be 1 to trigger. correct me if i'm wrong. else ill try it tomorro

  13. #13
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    My assumption is LCDOUT is too long to execute... only assumption. BTW i'll try it in a few. I'll check everything with the datasheet.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  14. #14
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    You need to read RCREG to clear RCIF. I don't think you can clear it with pir1.5 = 0. If you don't clear RCIF you'll jump right back into the int handler each time you re-enable interrupts exiting your int handler.

    Try something like this. Just change the LCD defines to match your LCD setup.
    Code:
        DEFINE OSC 40                ' _HSPLL_OSC_1H & _HS_OSC_1H
    	
    	' // Setup for dev board LCD pinout
        DEFINE  LCD_DREG    PORTB 	 ' LCD I/O port
        DEFINE  LCD_DBIT    4        ' 4-bit data from RB4 to RB7
        DEFINE  LCD_RSREG   PORTB    ' Register select port
        DEFINE  LCD_RSBIT   2	    ' Register select pin
        DEFINE  LCD_EREG    PORTB    ' Enable port
        DEFINE  LCD_EBIT    3	    ' Enable pin
        DEFINE  LCD_BITS    4	    ' 4-bit data bus
        DEFINE  LCD_LINES   2        ' 2-line LCD
        DEFINE  LCD_COMANDUS 2000    ' LCD command delay
        DEFINE  LCD_DATAUS   50      ' LCD data delay	
    	
        ' // Set USART parameters
        DEFINE  HSER_TXSTA  24h      ' Enable TXEN and BRGH=1
        DEFINE  HSER_RCSTA  90h      ' SPEN & CREN = 1
        DEFINE  HSER_SPBRG  129      ' SPBRG val for 19,200bps @40MHz    
        
        ' // Set USART interrupts, A/D, reg defs, etc,,
        SYMBOL RCIF = PIR1.5         ' Received character int flag
        INTCON = %11000000           ' enable global and Peripheral interrupt
        PIE1.5 = 1                   ' USART receive interrupt enabled
        ADCON1 = %00000111           ' Turn off A/D all digital
    
        X       VAR BYTE
        Teller  var byte
        
        pause 1000               ' LCD power-up / init time
        lcdout $FE,1              ' Clear screen / home cursor
        
        on interrupt GoTo handle ' Point to int handler
        
    Main:
        lcdout $FE,1,dec teller  ' Print to LCD clearing previous char
        for X = 0 TO 50          ' Loop for 1 second
            pause 20
        next X
        goto Main
    
        Disable ' Interrupt handler
    Handle:
        while RCIF         ' While RCIF is set, keep reading characters
         Teller = RCREG ' Reading character into Teller clears RCIF
        wend
        Resume
        Enable
        
        END
    You may need to edit your default PBP 18F452.INC header file to make sure you're turning on HSPLL for 40MHz with a 10MHz crystal.

    Commented out this line.
    ;__CONFIG _CONFIG1H, _OSCS_OFF_1H & _XT_OSC_1H
    Add this below it, and save the file.
    __CONFIG _CONFIG1H, _HSPLL_OSC_1H & _HS_OSC_1H
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  15. #15
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    Hello again! I tested the idea's but it doesn't work.... and it did work on a pic 16C877 the thing with the pir register(not this project).... is it possible if the bitrate does not match that it will not trigger the interrupt? because I use a pic16f628 @ this high speed and it runs on its internal osc. speed 4mhz. since time is not really a problem is it advisable to lower the speed? and what settings is preferable for an error free transfer? THX for your support already.

    EDIT: I'm sure the pic gets a signal but I don't know if it is correct.

  16. #16
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    what about if you send your data on LCD without any interrupt. Do you get the great data? Case not, your baudrate setting is no correct or your internal crystal don't provide a really accurate frequency for your baudrate.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  17. #17
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    Code:
    Main:
        lcdout $FE,1,Dec(Teller)  ' Print to LCD clearing previous char
        for temp = 0 TO 50          ' Loop for 1 second
            pause 20
        next temp
        Teller=  Teller + 1
        HSerin [WAIT("A"),STR TimeDate\6]
        goto Main
    I tested it with this piece of code and it doesn't work(it stays zero) so I think it is a sync problem I'm going try to lower the baud rate.. what settings are preferable?

  18. #18
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Let's do it safe let's choose 2400 Bauds

    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_SPBRG 103

    and then if it's working :

    @ 9600 bauds

    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_SPBRG 25

    @ 19200 bauds(not sure with internal osc)

    DEFINE HSER_TXSTA 24h
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_SPBRG 12
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  19. #19
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    ok, that are the settings for the 16f628 but what do i need to set for a pic18f452 running @ 40mhz? the data sheet says N/A

  20. #20
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    Well I just learned a few things about PBP USART defines.

    1. If you use PBP USART defines like DEFINE HSER_TXSTA 24h, but do "not" use HSEROUT or HSERIN somewhere in the program, these defines don't configure the USART like one might assume.

    In this case you need to write directly to USART registers to setup everything.

    TXSTA = $24 ' Enable TXEN and BRGH=1
    RCSTA = $90 ' SPEN & CREN = 1
    SPBRG = 129 ' SPBRG val for 19,200bps

    2. This also goes for DEFINE HSER_CLOERR 1. If you don't also use HSERIN or HSEROUT, then OERR never gets "automatically" cleared on over-run, and of course, it goes like splat when you shoot more than 2 characters at the USART before emptying RCREG.

    This program below has been tested, and it definitely does generate a USART interrupt even with a baud rate missmatch.

    Notes:
    If you send 1 character, it displays that character.
    If you send 2 characters, it displays the 2nd received.
    If you send 3 or > characters, it still dispays only the 2nd character received because anything over 2 bytes shot at the USART before RCREG is cleared isn't transferred into RCREG from RSR.

    This was tested with a PC sending serial data, but it should work the same with anything sending asynchronous serial data.
    Code:
        DEFINE OSC 40             ' _HSPLL_OSC_1H & _HS_OSC_1H
    	
    	' // Setup for dev board LCD pinout
        DEFINE  LCD_DREG    PORTB ' LCD I/O port
        DEFINE  LCD_DBIT    4     ' 4-bit data from RB4 to RB7
        DEFINE  LCD_RSREG   PORTB ' Register select port
        DEFINE  LCD_RSBIT   2	  ' Register select pin
        DEFINE  LCD_EREG    PORTB ' Enable port
        DEFINE  LCD_EBIT    3	  ' Enable pin
        DEFINE  LCD_BITS    4	  ' 4-bit data bus
        DEFINE  LCD_LINES   2     ' 2-line LCD
        DEFINE  LCD_COMANDUS 2000 ' LCD command delay
        DEFINE  LCD_DATAUS   50   ' LCD data delay	
    	
        ' // Set USART parameters
        TXSTA = $24              ' Enable TXEN and BRGH=1
        RCSTA = $90              ' SPEN & CREN = 1
        SPBRG = 129              ' SPBRG val for 19,200bps @40MHz   
        
        ' // Set USART bit aliases
        SYMBOL RCIF = PIR1.5     ' Received character int flag
        SYMBOL OERR = RCSTA.1    ' Over-run error bit
        SYMBOL CREN = RCSTA.4    ' Continuous receive enable/disable bit
        
        ' // Setup A/D, variables, etc,,
        ADCON1 = %00000111       ' A/D off, all digital
        X      VAR BYTE          ' Loop var
        Teller VAR BYTE          ' Holds char for display
        Teller = "0"             ' Start with ASCII 0
        
        ' // LCD init time / clear, home cursor
        PAUSE 1000               ' LCD power-up / init time
        lcdout $FE,1             ' Clear LCD
        
        ' // Setup interrupts
        INTCON = %11000000       ' Enable global / peripheral interrupt
        PIE1.5 = 1               ' USART receive interrupt enabled
        
        on interrupt GoTo handle ' Point to int handler
        
    Main:
        lcdout $FE,1,Teller      ' Clear LCD / diaplay last char
        FOR X = 1 TO 50          ' Loop for 1 second in 20mS
            PAUSE 20             ' intervals
        NEXT X
        goto Main
    
        Disable                 ' Disable interrupts while in interrupt handler
    Handle:
        IF OERR THEN            ' Clear over-runs if OERR set
           CREN = 0             ' Disable USART receive
           CREN = 1             ' Re-enable USART receive
        ENDIF
        Teller = RCREG          ' Read RCREG buffer twice to
        Teller = RCREG          ' clear RCIF interrupt flag bit
        Resume
        Enable
    
    	end
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  21. #21
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Originally posted by Bruce
    Well I just learned a few things about PBP USART defines.

    1. If you use PBP USART defines like DEFINE HSER_TXSTA 24h, but do "not" use HSEROUT or HSERIN somewhere in the program, these defines don't configure the USART like one might assume.

    In this case you need to write directly to USART registers to setup everything.

    TXSTA = $24 ' Enable TXEN and BRGH=1
    RCSTA = $90 ' SPEN & CREN = 1
    SPBRG = 129 ' SPBRG val for 19,200bps
    That's interesting ! Thanks Bruce!

    egberttheone
    ok, that are the settings for the 16f628 but what do i need to set for a pic18f452 running @ 40mhz? the data sheet says N/A


    In fact it make sense that a PIC who run @40MHZ provide slow serial com. The slowest you can do @40MHZ is 9600 Bauds

    Everything is in the datasheet! @40 MHZ for 9600 bauds SPBRG=64 TXSTA=20h, RCSTA=90h
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  22. #22
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    YES the interrupt does accure now! but i get a compiler error when i add "HSerin 500,TimeOut,[WAIT("A"),STR TimeDate\6]" into the routine "Handle"; the error is also resolved by setting the osc speed to 20 any idea ?

    Code:
     "pbppic18.lib 7153: argument out of range. least significant bits used"
    if i just ignor the error and programm the device then it does jump to the interrupt but it does not receive any thing it jumps to timeout routine.

    EDIT:

    Originally posted by mister_e
    That's interesting ! Thanks Bruce!

    egberttheone

    In fact it make sense that a PIC who run @40MHZ provide slow serial com. The slowest you can do @40MHZ is 9600 Bauds

    Everything is in the datasheet! @40 MHZ for 9600 bauds SPBRG=64 TXSTA=20h, RCSTA=90h
    yeah i found out 9600 was the minimum @40mhz
    Last edited by egberttheone; - 27th January 2005 at 20:40.

  23. #23
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    If you use HSERIN & HSEROUT, then use the PBP USART defines.

    Otherwise, when you compile, the PBP USART library routines attempt to set USART registers & baud rate automatically based on the defined OSC value.

    If the defined OSC speed doesn't jive with 2400 baud (which is the PBP default data rate if you do not use the USART defines), then it returns the error "Argument out of range".

    That's why when you change DEFINE OSC 40 to DEFINE OSC 20 it works. 40MHz didn't work out during PBP's attempt to compute reg values for 2400 bps by default.

    Look in your PBPPIC18.LIB file just under ;* Default hardware serial port values.

    You'll see the logical progression taken through the library as it tries to setup default USART parameters.

    ifndef HSER_BITS
    HSER_BITS = 8 ; Default to 8 bits
    endif

    If NOT defined HSER_BITS, then by default let's use 8-bit.

    ifndef HSER_RCSTA ; Receive register data
    if (HSER_BITS != 9)
    HSER_RCSTA EQU 90h ; Receiver enabled
    else
    HSER_RCSTA EQU 0d0h ; Receiver enabled for 9 bits
    endif

    If NOT defined HSER_RCSTA and if HSER_BITS is NOT = 9, then set HSER_RCSTA to 90h. Or else set it to 0d0h for 9-bit.

    Follow this down to where OSC, HSER_TXSTA, and HSER_BAUD are used to "automatically" compute the value for HSER_SPBRG and you'll see why the argument out of range error pops up. The numbers don't work out for 2400bps at 40MHz.

    In short;

    If you're not using HSERIN or HSEROUT, and just want to do everything manually by reading RCREG, handling over-runs, clearing RCIF, etc, then setup the USART registers manually as mentioned previously.

    If you "are" using HSERIN & HSEROUT anywhere in your program, then you need to use the PBP USART defines - or select an oscillator speed that works with the default 2400bps.
    Last edited by Bruce; - 27th January 2005 at 21:45.
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

  24. #24
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    ahhh thats why it did not work because the word hserout/hserin was not used ! i changed it back to the normal define's and putted the word hserin and it still goes to the interrupt! but it still goes to time out well ill(we) figure it out next week first some time for my girl friend thank you very much for your help already your very clear in explaining!

  25. #25
    egberttheone's Avatar
    egberttheone Guest


    Did you find this post helpful? Yes | No

    Default

    Hi all! evry thing is running smoothly now thanks all! here are some pic's pic1 pic2

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


    Did you find this post helpful? Yes | No

    Wink

    Bruce?

    ==================================================
    In short;

    If you're not using HSERIN or HSEROUT, and just want to do everything manually by reading RCREG, handling over-runs, clearing RCIF, etc, then setup the USART registers manually as mentioned previously.

    If you "are" using HSERIN & HSEROUT anywhere in your program, then you need to use the PBP USART defines - or select an oscillator speed that works with the default 2400bps.
    ==================================================

    I'm trying to receive a file to a PIC from a PC. I am able to manually send data via the serial window in Studio Plus to 2 consecutive HSERINs in the program, but I'd like it to be automatic. I'd like the 1st HSERIN to read the 1st variable, and then the 2nd HSERIN to read the balance of the record. As it stands I have to click SEND twice.

    Do I have to do everything manually as you describe in option 1, or is there a method using HSERINs? Basically I'd like to set this up so it can read the entire file without manual intervention.

    Specs: PIC 16F877, 20MHz crystal, COM1, MAX232CPE inverter, 19200 Baud, Windows Home XP, Studio Plus 2.1.0.8, PIC BASIC Pro 2.45a, caucasian, 6', married, 3 daughters, overweight, lazy and slowly going insane.

    Thanks!

    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!

  27. #27
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Robert,

    in this case use of two Hserin can work. You'll need 1 extra i/o to confirm to pc to send next character.

    By example, if you plan to download an EEPROM dump from your PC to your PIC and then dump it to an external eeprom, you need some time to get character, place in var, send to external eeprom, wait the appropriate delay time required by your EEPROM, and wait for the next character.

    Easier with SERIN2 that handle everything for you and provide this extra 'flow control' pin.
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

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


    Did you find this post helpful? Yes | No

    Default

    Thanks Steve.

    Ok, so I've converted my code over to SERIN2 and SEROUT2. One problem, don't know where to connect the 'flow' pin on the RS232 connector. I've chosen to try the resistor/inverted technique.

    The manual doesn't mention that pin, so I'm doing searches now on where to connect it.

    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!

  29. #29
    Join Date
    Jul 2003
    Posts
    2,405


    Did you find this post helpful? Yes | No

    Default

    What's the purpose of two HSERIN's?
    Regards,

    -Bruce
    tech at rentron.com
    http://www.rentron.com

Similar Threads

  1. My USART problems..
    By Glenn in forum mel PIC BASIC Pro
    Replies: 9
    Last Post: - 31st July 2009, 01:00
  2. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  3. USART TXREG Problems
    By BigH in forum Serial
    Replies: 2
    Last Post: - 11th January 2006, 00:30
  4. Replies: 5
    Last Post: - 1st December 2004, 12:49
  5. Synchronous USART problems... HELP!!!
    By moni in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th November 2003, 19:00

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