Writing to a table.


Closed Thread
Results 1 to 5 of 5
  1. #1
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest

    Default Writing to a table.

    I have 48 hex bytes of data that I would like to write to a table. I have played with the lookup2 and lookdown2 that the PBP has to offer and continuing with the thought of how to write to a table I am stumped. Reading from the table is not bad, I do not have a problem with that, it is trying to write to one.

    Looking at my program what I am trying to do it find the position of what I want to write to on my table, example: position 1, and write to it rather than write to a value. I review to what I have I might just be writing to a number/constant.

    The program is attached and the part that I am talking about is Labeled CHNL. If anyone has help to this problem I would appreciate it.
    Attached Files Attached Files

  2. #2
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    The prog that i have attached to this is something that I am looking at wanting to do. Is there anything that anyone might have for suggestions.

    Thanks
    Attached Files Attached Files

  3. #3
    Join Date
    Oct 2004
    Location
    Italy
    Posts
    695


    Did you find this post helpful? Yes | No

    Default

    Code:
    Hi,
    
    I understand that with the PIC16F648 you control the 
    configuration of the 7 Control channels of a radio control (R/C). 
    
    For each of the 7 control channels you have the following parameters: 
     
    - Servo Reversing (1 byte)
    
    - Variable Dual Rate (3 bytes)
    
    - Adjustable Travel Volume  (3 bytes)
    
    These parameters are stored in the EEPROM of the PIC.
    For each control channel you use 7 bytes of EEPROM. 
    In total 49 bytes are used in the EEPROM. 
    
    Store the values in the EEPROM as data blocks. 
    Each block of data will contain the 7 bytes necessary
    to store the parameters of a channel. We will call
    these data blocks RECORDS. Below you can see the
    map of your EEPROM. The first 7 bytes (0-6) of the 
    EEPROM are not used and are available for other uses.
    
    * * *
    
    EEPROM map
    
    Where: 
    
    X= Not used
    R= Servo Reversing (1 byte)
    DDD= Dual Rates (3 bytes)
    TTT= Travel Volume (3 bytes)
    
     REC 0  REC 1  REC 2  REC 3  REC 4  REC 5  REC 6  REC 7
     DUMMY  (CH1)  (CH2)  (CH3)  (CH4)  (CH5)  (CH6)  (CH7)
    _______-------_______-------_______-------_______-------
    XXXXXXXrdddtttRDDDTTTrdddtttRDDDTTTrdddtttRDDDTTTrdddttt
    01234567891111111111222222222233333333334444444444555555 (EE Address)
              0123456789012345678901234567890123456789012345 
    
    
    To find out the record address for the selected channel:
    (You know the channel number because you have selected it on the LCD).
    
    record_address = channel_number * 7
    
    Once you have calculated the record address:
    (The address of the first byte of the record).
    
    ------------------------------------------
    
    To read the Servo Reversing byte from the EEPROM:
    
    READ record_address, servo_reversing
    
    ------------------------------------------
    
    To read the Dual Rate first byte from the EEPROM:
    
    READ record_address + 1, dual_rate_b1
    
    To read the Dual Rate second byte from the EEPROM:
    
    READ record_address + 2, dual_rate_b2
    
    To read the Dual Rate third byte from the EEPROM:
    
    READ record_address + 3, dual_rate_b3
    
    ------------------------------------------
    
    To read the Travel Volume first byte from the EEPROM:
    
    READ record_address + 4, travel_volume_b1
    
    To read the Travel Volume second byte from the EEPROM:
    
    READ record_address + 5, travel_volume_b2
    
    To read the Travel Volume third byte from the EEPROM:
    
    READ record_address + 6, travel_volume_b3
    
    ------------------------------------------
    
    Below are the variables in RAM.
    These variables are used as temporary storage and their 
    content will change based on the selected channel number.
    
    channel_number 
    record_address
    servo_reversing
    dual_rate_b1
    dual_rate_b2
    dual_rate_b3
    travel_volume_b1
    travel_volume_b2
    travel_volume_b3
    
    
    Do the same to WRITE to the EEPROM.
    
    
    Best regards,
    
    
    Luciano
    Last edited by Luciano; - 23rd December 2005 at 18:41.

  4. #4
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    took a little time to come with it huh. I like it. I will have to sit down and look at it several time to learn what you did. I can say that I understand and follow it, but to truly I learn something, I will have to sit and read. Thanks man.

  5. #5
    Rhatidbwoy's Avatar
    Rhatidbwoy Guest


    Did you find this post helpful? Yes | No

    Default

    it is wonderful. I reviewed it and made sense of it. It is the table I was really looking for. What is does is to transform a table into more so the equation and it does work. Thanks!

Similar Threads

  1. Origin of Assembly Table
    By dksoba in forum mel PIC BASIC Pro
    Replies: 5
    Last Post: - 8th February 2010, 19:34
  2. Lookup Table
    By yasser hassani in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 11th March 2008, 10:38
  3. PICBasic newbie problem
    By ELCouz in forum mel PIC BASIC Pro
    Replies: 32
    Last Post: - 12th February 2008, 00:55
  4. PIC 18F452 Table Pointer/ Table Read
    By sougata in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 14th March 2006, 03:07
  5. Message String Table using Readcode
    By mytekcontrols in forum Code Examples
    Replies: 2
    Last Post: - 10th July 2005, 23:17

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