Working with indivividual bytes of an array


Results 1 to 6 of 6

Threaded View

  1. #5
    Join Date
    Jan 2006
    Location
    Istanbul
    Posts
    1,185


    Did you find this post helpful? Yes | No

    Default

    In addition to sougata's, here is a conversion from Melanie's.
    You need to convert your decimal values to HEX values and then you can write the HEX values to your RTC chip.


    Code:
    DecVal = HOUR
    GOSUB ConvertBCD
    HOUR = HEXVal
    
    'Now you set your RTC chip with this new HOUR variable (which is now in HEX).
    
    
    ConvertBCD:                            
            HEXVal = DecVal DIG 1
    	HEXVal = HEXVal <<4
    	HEXVal = HEXVal + DecVal DIG 0
    	RETURN

    ----------------

    Edit: also take a look at this post here: http://www.picbasic.co.uk/forum/showthread.php?t=110
    Last edited by sayzer; - 30th December 2006 at 09:30.

Similar Threads

  1. Bits, Bytes Words and Arrays
    By Melanie in forum FAQ - Frequently Asked Questions
    Replies: 24
    Last Post: - 14th June 2016, 07:55
  2. Simple Array Demo
    By Archangel in forum Code Examples
    Replies: 5
    Last Post: - 15th February 2010, 04:46
  3. Array larger than 256 bytes
    By Ron Marcus in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 27th November 2005, 15:38
  4. Inverting a Word & Assigning Array To Bytes
    By CocaColaKid in forum mel PIC BASIC Pro
    Replies: 4
    Last Post: - 25th August 2005, 23:44
  5. Best way to store array of bytes?
    By Deadeye in forum General
    Replies: 1
    Last Post: - 1st June 2005, 05:35

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