usart-bluetooth problem


Closed Thread
Results 1 to 33 of 33

Hybrid View

  1. #1
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,627


    Did you find this post helpful? Yes | No

    Default Re: usart-bluetooth problem

    Yeah take the EEPROM out of the picture to begin with.
    And I'm not sure about the way you're sending the values back to the PC. From the PC you're sending as ASCII and in interpreting it as 2 digit hex values (each preceeded by an 'a'). You're storing the values as bytes. Then you're sendng them back as a raw (binary) to the PC. Is the terminal program then setup to interprest the value 20 as 14(hex) or how is it supposed to work?

    Code:
    FOR d=0 to 63
       HSERIN [wait ("a"), hex2 H[d]]
    NEXT
    
    FOR d = 0 to 63
       HSEROUT[H[d]]    ' Send raw byte values
    NEXT
    
    ' OR...
    
    FOR d = 0 to 63
      HSEROUT[HEX2 H[d]]    ' Send ASCII text representing the values as two hexadecimal digits
    NEXT
    
    ' OR...
    
    HSEROUT[STR H\64]     ' Send string as raw values

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


    Did you find this post helpful? Yes | No

    Default Re: usart-bluetooth problem

    I just verified the method here and it works just fine, with 128 values.
    Here's the code I used:
    Code:
    i       VAR BYTE
    j       VAR BYTE
    Array   VAR BYTE[128]
    
    PAUSE 3000
    
    Main:
      GOSUB ClearArray
    
      HSEROUT["Enter new values...", 13]
      
      For i = 0 to 127
          HSERIN[WAIT ("a"), HEX2 Array[i]]
      NEXT
      
      ' Send values back, the Array[i-1] and i//16 stuff is just there
      ' to format the output a little better, for readabillity.
      For i = 1 to 128
        HSEROUT[HEX2 Array[i-1]]
        IF i // 16 = 0 THEN
            HSEROUT[13]
        ELSE
            HSEROUT[","]
        ENDIF
      NEXT
        
        HSEROUT[13, "DONE", 13]
      
      Goto Main
    
    
    ClearArray:
        For i = 0 to 127
            Array[i] = 0
        NEXT
    RETURN
    And here's the result:

    Name:  HEX string.jpg
Views: 2505
Size:  89.0 KB

    Now, this was on a 18F25K20 running at 64MHz, which is 16 times faster than 4MHz. On the other hand I used 115200 baud which is 12 times faster than 9600. If it refuses to work at your end then, as a test, decrease the baudrate or increase the oscillator speed.

    /Henrik.

  3. #3
    Join Date
    Jan 2013
    Location
    Texas USA
    Posts
    229


    Did you find this post helpful? Yes | No

    Default Re: usart-bluetooth problem

    I agree Henrik.

    Works fine in the simulator, given you set the output method the way you need.

    I also ran Murat's software through the simulator with a simulated 24C256 EEPROM.
    This works fine as well since the 24C256 supports a 128 byte page write operation.

    I bet the issue Murat is that the EEPROM you are using does not support a 64 byte page write.
    What EEPROM are you using?

    Also, with PBP (not PB) you do not need to change the Control byte of the I2C Read/Write commands.
    You are setting the I2CWRITE control byte to ($A0) and then the I2CREAD control byte to ($A1).
    PBP takes care of setting the LSB of the control byte for you.
    For either a Write or Read, the control byte should be $A0.
    This is indicated in the manual for the I2CREAD command.

    So your I2C operations should look like this.

    I2CWRITE SDA,SCL,DATAYAZMA,B,[STR H\64]
    PAUSE BEKLE
    I2CREAD SDA,SCL,DATAYAZMA,B,[STR G\64]

    Where DATAYAZMA = $A0.
    Regards,
    TABSoft

Similar Threads

  1. Bluetooth headset for non bluetooth devices?
    By Normnet in forum Bluetooth
    Replies: 4
    Last Post: - 26th September 2015, 11:22
  2. USART SPI problem !
    By TripleS in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 16th October 2007, 22:09
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  5. PIC16F688 USART problem
    By Kees Reedijk in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 2nd October 2006, 04:59

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