help with how PIC stores values


Closed Thread
Results 1 to 4 of 4
  1. #1
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838

    Default help with how PIC stores values

    Hi just starting out using pic basic pro and PICs in general and have some basic questions on writing and reading the values into eeprom PIC (12F683) if someone can give some input

    i wish to write the captured measured values of pulsin directly to the pic for IR code (32 bits) on a pic running internal at 4mhz and generate the same pulse streem out with the correct timing from the stored values

    if a value of say 150 is recieved - then this would be 150 x 10us = 1.5ms pulse i believe

    using the following code would values stored higher than 255 be read back correctly ? , if not what coding would

    regards


    Code:
     Leader VAR WORD     ' will be up to 900 for a 9mS leader pulseBtnVal VAR BYTE[32] ' holds 32 pulse results
    
    
    
     FOR X = 0 TO 31          ' grab 32 incoming pulses
          PULSIN GPIO.0,1,BtnVal(X) ' now measuring high-going pulse widths
      NEXT X
         
         x = 0
         
       for x = 0 to 31    ' store timed values in pic 
        write x , BtnVal(X)
        pause 1000   ' wait 10ms before writing next value - not sure if required will reduce / remove after testing 
       next X

  2. #2
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: help with how PIC stores values

    any input guys ???

  3. #3
    Join Date
    Mar 2003
    Location
    Commerce Michigan USA
    Posts
    1,166


    Did you find this post helpful? Yes | No

    Default Re: help with how PIC stores values

    well, if you only have the variable sized as a byte, you cnt have a value bigger thn 255. However, if you have a word sized variable then you would store the upper byte to a single storage element then, store the lower byte to the next proceeding storage element. You would just read the upper byte and then the lower byte into a word sized variable when ready to read it from memory.
    Dave Purola,
    N8NTA
    EN82fn

  4. #4
    Join Date
    Feb 2012
    Location
    PERTH AUSTRALIA
    Posts
    838


    Did you find this post helpful? Yes | No

    Default Re: help with how PIC stores values

    ok thanks will do some playing

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