some help with math


Closed Thread
Results 1 to 40 of 65

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default Re: some help with math

    count in the table is Menu_subtxt varable
    end code in the table is the value of SDC_Byte
    byte code in table the intrum caculation prior to mulitply data length

  2. #2
    Join Date
    Oct 2005
    Location
    Sweden
    Posts
    3,621


    Did you find this post helpful? Yes | No

    Default Re: some help with math

    Try
    Code:
    EndValue = ((Count - 1) // 6) * 42
    Is that what you want?

    /Henrik.

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


    Did you find this post helpful? Yes | No

    Default Re: some help with math

    interesting results

    i now format the data as word value which now stores the data in the correct byte by byte sequance form ,

    however readcode reads the address data back incorectly for a given address when reading as byte value

    i assume its cos readcode is word based command ???

    is there a way to read the data back for each address byte only ?

    as can be seen on address 5172, 5173 byte values are incorrect for the given address

    Code:
    LG_Font_Base:
              ' Note gl_x char space need be 12 , not normal 24 when using chr else too big a gap space _
              ' Code for "-"  Asci 45    90 real values _
    @ dw      0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000;,0x00      
    @ dw      0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x3FFC,0x003F,0xFC00,0x3FFC     
    @ dw      0x003F,0xFC00,0x3FFC,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000;,0x00  
    @ dw      0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000,0x0000
    part of flash dump of font stored

    Code:
    5170- 0000 3ffc 003f fc00 3ffc 003f fc00 3ffc 
    5180- 0000 0000 0000 0000 0000 0000 0000 0000 
    5190- 0000 0000 0000 0000 0000 0000 0000 0000 
    51a0- 0000 
    
    terminal debug dump - for each address read by readcode 
    5170- 0  ,  5171- 0,
    5172- FC,  5173- 3F,
    5174- 3F,  5175- 0,
    5176- 0 ,   5177- FC,
    5178- FC,  5179- 3F,
    517A- 3F,  517B- 0,
    517C- 0 ,  517D- FC,
    517E- FC, 517F- 3F,
    5180- 0  , 5181- 0

  4. #4
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: some help with math

    I will see if I can explain it

    pic18 pgm mem is stored as words , so if the bytes are not an even number the last byte is padded with 00


    if we store this @ db "say",34,"hello",34,0

    then its stored like this lst file extract

    00014A 6173 2279 6568 db "say",34,"hello",34,0 ; note order looks reversed but its really lowbyte first
    6C6C 226F 0000

    when readcode reads it back

    its lowbyte, highbyte

    so the string is returned in order as say"hello",0
    Last edited by richard; - 16th September 2015 at 06:40.

  5. #5
    Join Date
    May 2013
    Location
    australia
    Posts
    2,680


    Did you find this post helpful? Yes | No

    Default Re: some help with math

    when stored as words
    @ dw 0x0000,0x0000,0x53d7,0x53d7,0x53d7,0x53d7,0x53d7,0 x53d7,0x53d7,0x53d7,0x53d7,0x0000,0x0000,0x0000,0x 0000,0x0000


    lst file looks like this


    003CF6 0000 0000
    53D7 06827
    0000,0x0000
    53D7 53D7 53D7
    53D7 53D7 53D7
    53D7 53D7 0000
    0000 0000 0000
    0000
    note the order is now not reversed

Similar Threads

  1. Help with A/D math!
    By dbodenheimer in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 19th March 2011, 00:51
  2. Math help please...
    By Ioannis in forum General
    Replies: 2
    Last Post: - 20th June 2008, 10:18
  3. PBPL Math...new math takes more cycles...Always?
    By skimask in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 10th February 2008, 10:22
  4. Math help please!!!
    By jbirnsch in forum mel PIC BASIC Pro
    Replies: 6
    Last Post: - 10th August 2007, 14:45
  5. math help
    By houa in forum mel PIC BASIC Pro
    Replies: 3
    Last Post: - 30th January 2006, 16:58

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