Reading string HRSin


+ Reply to Thread
Results 1 to 4 of 4

Thread: Reading string HRSin23 days old

  1. #1
    Junior Member mriouglass123's Avatar
    Join Date
    Jul 2020
    Posts
    5
    Thumbs Up
    Received: 0
    Given: 0
    Total Downloaded
    0

    0 Not allowed!

    Default Reading string HRSin

    Hello all,

    I am in the progress of developing on a project.

    This involves a PIC18F25K80 that communicates with a bluetooth module dongle.

    Now, this BT module has built in commmands that you can send to it and it will respond back.

    So my question is, how do I print and use the response given when I send out a commnand from the PIC to the BT module?

    What I mean is for example, a command that can be sent to BT module is get ua b", the BT mobule will repond back badu rate of the module back to the PIC. However, I am unable to read the response on terminal using RSOut.

    This is my code.

    Code:
                        Device 18F25K80           
                        Xtal=16
                        All_Digital=True
                         
                        Config_Start
                                        RETEN = On
                                        INTOSCSEL = High
                                        SOSCSEL = Dig          'RC1 digital
                                        XINST = Off
                                        FOSC = HS1
                                        PLLCFG = OFF
                                        FCMEN = OFF
                                        IESO = OFF
                                        PWRTEN = On
                                        BOREN = off
                                        BORV = 0               'reset if voltage is below 2.7V
                                        BORPWR = High
                                        WDTEN = NOSLP
                                        WDTPS = 512            'watchdog = 2 seconds
                                        CANMX = PORTC
                                        MSSPMSK = MSK7
                                        MCLRE = On
                                        STVREN = On
                                        BBSIZ = BB2K
                                        Cp0 = On
                                        CP1 = On
                                        CP2 = On
                                        CP3 = On
                                        CPB = On
                                        CPD = OFF
                                        WRT0 = OFF
                                        WRT1 = OFF
                                        WRT2 = OFF
                                        WRT3 = OFF
                                        WRTC = OFF
                                        WRTB = OFF
                                        WRTD = OFF
                                        EBTR0 = On
                                        EBTR1 = On
                                        EBTR2 = On
                                        EBTR3 = On
                                        EBTRB = On
                        Config_End
                          
                        OSCCON = 111100
                        
    '------------------ PORT CONFIG ----------------------'
    
    
        '------------ PORT A --------------'
        
        'A0: RSOut          output
        'A1: NC
        'A2: LED2           output
        'A3: LED1           output
        'A4: NC (VDDCORE)
        'A5: NC
        'A6: OSC2
        'A7: OSC1
        
        ANCON0 = 000000
        PORTA  = 000000
        TRISA  = 000010
        
        Symbol LED2 =     PORTA.2
        Symbol LED1 =     PORTA.3
        
        '---- RSOut ----'
        
        Declare RsOut_Pin PORTA.0 ' pin for reading RSOut
        Declare Serial_Baud 9600  ' set baud rate to 115200                   
        Declare RsOut_Mode True      '*** to use serial to usb converter in debugging mode
        
        
        '------------ PORT B --------------'
        
        'B0: Button_0 input
        'B1: NC
        'B2: NC
        'B3: NC
        'B4: NC
        'B5: NC
        'B6: ICSP-PGC
        'B7: ICSP-PGD
        
        ANCON1 = 000000
        PORTB  = 000000
        TRISB  = 000001
        
        Symbol BUTTON_0 = PORTB.0  
           
        '------------ PORT C --------------'
        
        'C0: NC
        'C1: NC
        'C2: NC
        'C3: NC
        'C4: CTS input
        'C5: RTS output
        'C6: TX output
        'C7: RX input
        
        PORTC = 000000
        TRISC = 010000
    
    '    Symbol TX  =   PORTC.6
    '    Symbol RX  =   PORTC.7
        
            'EUSART (port RC6 No.1) 115200 hardware baud
        Declare Hserial_Baud 115200
        RCSTA1 = 000000
        TXSTA1 = 100100
        Declare Hserial_Clear On
        BAUDCON1 = 001000
        SPBRG1 = 35
        SPBRGH1 = 0
        
    '----------- SETUP FOR TRANSMITTING AND RECEIVING ---------'
        
    '    Declare HSerial1_Terminator = LFCR ' Line feed followed by carriage return
    '    Declare HRSOut_Pin = PORTC.6
    '    Declare HRSIn_Pin = PORTC.7
    
        Dim Var1 As Word   
    
    looping: GoSub watch
    
            
                HRSOut "get ua b", 13
                DelayMS 10
                
                Var1 = HRSIn
                    RsOut Var1, 13 ' should get the baud rate number of 115200
                
                GoTo looping
        
    '---------------------------------------------------------------------------------------------------             
    watch:
    Asm
                   Clrwdt
    EndAsm
                   Return 
    '--------------------------------------------------------------------------------------

  2. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  3. #2
    Prolific Poster RGV250's Avatar
    Join Date
    Aug 2005
    Posts
    2,416
    Thumbs Up
    Received: 31
    Given: 8
    Total Downloaded
    1.18 GB

    0 Not allowed!

    Default Re: Reading string HRSin

    Hi,
    I think a link to the datasheet or manual for the BT module might help.

    Regards,
    Bob

  4. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  5. #3
    Fanatical Contributor top204's Avatar
    Join Date
    Feb 2002
    Posts
    3,747
    Thumbs Up
    Received: 371
    Given: 177
    Total Downloaded
    2.09 GB

    0 Not allowed!

    Default Re: Reading string HRSin

    If the module is using an AT style interface, as most do, it will be receiving and returning ASCII characters.

    If this is the case, receiving a single 16-bit value will not produce the correct Baud value return.

    If it is using a character string interface, the returns will need to be received into a string or byte array, then parsed to recover the data.

  6. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

  7. #4
    Member keytapper's Avatar
    Join Date
    Jun 2019
    Posts
    257
    Thumbs Up
    Received: 11
    Given: 6
    Total Downloaded
    496.93 MB

    0 Not allowed!

    Default Re: Reading string HRSin

    I think that you should implement an interrupt and buffering the reception.

  8. Attention

    This valuable resource relies upon the very small amount of revenue generated by displaying online advertisements to our visitors.

    The advertisements we display are relevant to this web site and your browsing history

    Please consider supporting us by disabling your ad blocker.


    Note: Some users have reported issues related to ad-blockers rendering parts of this wesite unusable,
    where possible we will rectify the issues to enable you to use this resource with adblocking enabled.

    If you can, please report issues in the forum area WebSite / Forum Issues


    Thank you for your attention.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Similar Threads

  1. How to uesd HRSIn received string from PC (rs232)
    By Ploy in forum Proton Plus Compiler v3
    Replies: 1
    Last Post: 31st May 2013, 19:54
  2. Adding a second string to start of string
    By normnet in forum Proton Plus Compiler v3
    Replies: 2
    Last Post: 22nd February 2013, 22:13
  3. [SOLVED !] String comparrison when there are " in the string
    By AnthonyHarris in forum GSM / SMS
    Replies: 3
    Last Post: 16th January 2013, 09:20
  4. Writing/Reading String to EEPROM
    By marcasjr in forum Mecanique - IDE
    Replies: 1
    Last Post: 15th February 2010, 09:25

Tags for this Thread

Posting Permissions

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