Aaaaarrrrggghhhhh :-) Serial woes

Discussion in 'Questions (Windows Mobile)' started by taximania, Dec 10, 2008.

  1. taximania

    taximania Well-Known Member Licensed User

    Ok, I'm finally pronounced brain dead. Been at this 2 weeks now.
    Didn't want to bother you guys, (and gals ?)

    I'm trying to send a byte to a Microchip Pic controlling an LCD display.
    eg: 1 byte valued between 1 - 255

    serial.Output(? :sign0148: ?) WHAT !!

    I've tried
    serial.Output(textbox1.text)
    serial.Output(chr(textbox1.text))
    serial.Output(int(textbox1.text))

    I've tried serial.Output2(various variations)

    I can't get the display to reproduce a number over 127.
    128 shows 63 !
    Or the ascii symbol for the byte sent.

    Ascii is 0-127 ?????

    :sign0082:
     
  2. Cableguy

    Cableguy Expert Licensed User

    Last edited: Dec 10, 2008
  3. agraham

    agraham Expert Licensed User

    Yup, that's the problem with the default ASCII encoding when sending text through the Serial2 library. Serial.Output sends a String and as the standard Encoding is ASCII it won't send any character over 127. You should use Serial.Output2 which sends bytes that can have any value between 0 and 255. If you need to receive binary data then read the help for (and use) my SerialEx library.
     
  4. taximania

    taximania Well-Known Member Licensed User

    Cheers for the nudge you two :sign0188:

    In all my years of programming and using the Serial port,
    who'd believe only now am I trying to send a value larger than 127.

    I bet my other 2 graphic LCD projects might work now :sign0087:
     
  5. taximania

    taximania Well-Known Member Licensed User

    For those that might read this thread.
    Yup. How do you send a byte via Serial.

    Declare a Global variable, eg:
    Code:
    Byt(1as byte 'Single Array with one element.

    then use:

    Code:
    Byt(0)=129 '0= first elemenet of array, 129 is the value to send
    Serial.Output2(Byt()) 'Send the single Byte Array

    It's in the desktop helpfile :sign0148:
    Well, a similiar example is :)
     
  6. taximania

    taximania Well-Known Member Licensed User

    Got them both working now.

    Saving a 128 x 64 BMP drawn on a PPC, to a microchip 24LCxxx EEPROM has been sorted :sign0060:
    Reading a 24LCxxx image back to a 128 x 64 Graphic LCD is sorted.
    Not tried reading back to a PPC Image yet. One to try :)

    All this is done between a PIC microcontroler with a Bluetooth module connected, and my PPC via a Bluetooth serial connection.


    Yawn . . . . :sign0013:



    :sign0087:
     
  7. agraham

    agraham Expert Licensed User

    :sign0098: There's nothing like a bit of successful low level bit-twiddling with a bit of hardware to provide that warm inner glow of satisfaction and achievement (and provoke utter bewilderment on the part of the other half!).
     
  8. Cableguy

    Cableguy Expert Licensed User

    Yeah, what he said....
     
  9. seeyee520

    seeyee520 Member

    dose it work?


    i had do the same work as you did .
    i plan to use the PPC to control a microcontroller based of 51.
    the question is all data sent by the serial is 0xF8 and 0x80,not anyting else 。
    so how can i use the serial to transmit a hex data like 0x0c。???
     
  10. Erel

    Erel Administrator Staff Member Licensed User

    For some reason you appear as an unlicensed user in the forum. Please contact support@basic4ppc.com in order to fix it.
     
  11. seeyee520

    seeyee520 Member

    OMG.:sign0013:
    i am a student and the software was brought by school.
    So those limit could help to popularize your product ?
    TOO closed .it is hard to understand
     
  12. Erel

    Erel Administrator Staff Member Licensed User

Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice