String & WRITE


Results 1 to 17 of 17

Thread: String & WRITE

Threaded View

  1. #14
    Join Date
    Apr 2014
    Location
    OK
    Posts
    557


    Did you find this post helpful? Yes | No

    Default Re: String & WRITE

    Whether you wish to refer to a value in its decimal, hexadecimal, or binary format, when storing to the EEPROM, you are simply storing that value. When you READ it back, you may need to format it in its hexadecimal format for sending information serially, or displaying to an LCD. It looks like you are receiving these digits as ASCii, which allows for letters A-F. My approach would be to first convert the ASCii characters into Nibbles, then group them together into Hex. Finally you can store the Value in your EEPROM.

    To convert an ASCii character to a Hex nibble, subtract $30 from the numeric value of that nibble. Characters 0 >> 9 will be their 0 >> 9 raw value. Capital letters start at $41. Example, actual ASCii value of $41 = "A". You could use IF New_Data > $39 THEN : GOSUB DecodeLetters, ELSE : GOSUB DecodeNumbers. Using the shift and mask code listed previously, group your high nibble and low nibble together to create a new and complete byte value. Repeat for each 2-character grouping. When READing from the EEPROM, use the HEX modifier to send "Value" serially (ASCii representation). The key is that your ASCii value is $30 + Numbers (0 >> 9) and $37 + Letters (A >> F); conversely, ASCii - $30 = 0 >> 9 value while ASCii - $37 = A >> F values.
    Last edited by mpgmike; - 30th December 2017 at 19:12.

Similar Threads

  1. WRITE: One more PBP 2.60 Surprise ...
    By Acetronics2 in forum mel PIC BASIC Pro
    Replies: 22
    Last Post: - 26th August 2009, 09:10
  2. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  3. Microcontroller with 2 way paging application problem
    By oneohthree in forum mel PIC BASIC Pro
    Replies: 30
    Last Post: - 20th April 2007, 17:27
  4. Visual Basic 6 & Access 2000
    By Demon in forum Off Topic
    Replies: 33
    Last Post: - 7th September 2006, 04:39
  5. Storing Strings using the Write command
    By BobP in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 1st November 2005, 11:31

Members who have read this thread : 1

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