Hserout/Hserin via bluetooth


Closed Thread
Results 1 to 6 of 6

Hybrid View

  1. #1
    Join Date
    Oct 2009
    Posts
    583


    Did you find this post helpful? Yes | No

    Default Re: Hserout/Hserin via bluetooth

    Sending data via an HC bluetooth module is no different to sending it via normal serial, just that there is no physical cable between the two devices (such as a PC and the PIC).

    You could try using an FTDI usb to serial module and get the code working via hardwired setup and then use the HC module which should function exactly the same, if it doesn't then this would suggest that there may be a fault with the hardware.

    I use these in a couple of my projects to send decimal values from word variables to an application running on a PC

    Code:
    HSEROUT [dec4 CH1_MAX]
    HSEROUT [dec4 CH2_MAX]
    
    etc
    
    then
    HSERIN 1000, RX_Bombed, [dec4 CH1_MAX] 
    to read it back

    The RX Bombed is a time out

    Code:
    RX_Bombed:
        TimeoutCount = TimeOutCount + 1 
        end select 
    Goto main
    I then have this bit of code at the start of my comms subroutines

    Code:
    coms:
    
    HSERIN [nTest]
        SELECT CASE nTest
        CASE "Q"                    ; if Q then send data to PC
        Goto Term_TX 
        CASE "S"                    ; if S then receive data from PC
        goto Term_RX
    return
    In the main program loop I have this to check the buffer and jump to the comms subroutine

    Code:
    FOR TempWD = 0 TO 500
        IF RCIF=1 THEN GOSUB coms                   ; Check to see if PC application connected
        PAUSE 1
    next TempWD
    Hope this helps

    Sorry for got to add

    Code:
    RCIF                VAR PIR1.5                    ' USART receive flag
    Last edited by Scampy; - 1st February 2017 at 19:25.

  2. #2


    Did you find this post helpful? Yes | No

    Default Re: Hserout/Hserin via bluetooth

    Thank You for answer, maybe I found the problem. If I comment the "lcdout $fe,$80, dec datain" and "lcdout $fe,1" lines in my code the value in datain var come correct an stable.
    Then I put the datain value to other variable like:
    Code:
    main:
    hserin 500, main, [dec3 datain]
    pause 10
    let lcd_out = datain
    lcdout $fe,$80, dec3 lcd_out
    pause 20
    goto main
    And it works how I wish, luckily :-)

Similar Threads

  1. HSERIN and HSEROUT Pins
    By Dick Ivers in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 2nd March 2014, 22:08
  2. Problem with HSEROUT/HSERIN
    By financecatalyst in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 3rd July 2013, 10:43
  3. HSERIN and HSEROUT problems
    By amindzo in forum General
    Replies: 2
    Last Post: - 31st August 2006, 07:51
  4. Hserin/hserout ?
    By Scott in forum General
    Replies: 6
    Last Post: - 28th April 2005, 00:46
  5. Bluetooth wireless with PIC / HSERIN / DAC
    By rpatel in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 20th December 2004, 23:13

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