• Support
  • Articles
  • Resources
  • Products

Creating a Hex counter ... in tera term language

Moderator: boris

3 postsPage 1 of 1

dpena
Coach

Posts:
144
Joined: Thu Jul 09, 2009 6:14 pm
by dpena » Wed Jan 11, 2017 11:42 pm
Hi,

I need to write a hex counter starting with "5000 0000" and stop at "8000 0000" using tera term but having difficulty producing a conditional statement or modulo which will display the hex A, C and E values.

I need some sort of decoder to identify when dec 10 will equal hex A, dec 12 will equal hex C and dec 14 will equal hex E.

Here is the goal to start with address "0x5000 0000" and increment by 200:

Example:

5000 0000
5000 0200
5000 0400
5000 0600
5000 0800
5000 0A00
5000 0C00
5000 0E00

5000 1000

5000 1200
5000 1400
5000 1600
5000 1800
5000 1A00
5000 1C00
5000 1E00

5000 2000

5000 2200
5000 2400
5000 2600
5000 2800
5000 2A00
5000 2C00
5000 2E00

5000 3000

until it reaches

8000 0000


Here is the code I started which yields me the values I need minus the A, C and E values. You can copy and past it into TTLEditor and run it. I need it to follow the counting scheme above.

Code: Select all

  1.  
  2. ctr = 1
  3. loopctr = 0
  4. startaddr_str = "0x"
  5. startaddr_start_int = 50000000
  6. endingaddr_end_int  = 80000000
  7.  
  8. while startaddr_start_int < endingaddr_end_int
  9.  
  10.     sprintf2 cmd 'ddr --rd --from %s%d --bytes 0x200' startaddr_str startaddr_start_int
  11.    
  12.     startaddr_start_int = startaddr_start_int + 200
  13.     ;messagebox startaddr_start_int 'startaddr_start_int'
  14.    
  15.     if ((startaddr_start_int % 200) = 0) then
  16.        messagebox startaddr_start_int 'startaddr_start_int'
  17.    endif
  18.    
  19. endwhile
  20.  


Anyone know how to display the A, C and E in this loop??
IshmaelCallMe
Guru

Posts:
670
Joined: Thu Jan 26, 2006 2:28 am
by IshmaelCallMe » Thu Jan 12, 2017 4:56 pm
Try this:

Code: Select all

  1.  
  2.  
  3.     startaddr_str = "0x"
  4.     startaddr_start_int = 0
  5.     endingaddr_end_int  = 805306369
  6.     offset=1342177280
  7.      
  8.     while startaddr_start_int < endingaddr_end_int
  9.         tot=startaddr_start_int+offset
  10.         sprintf2 cmd 'ddr --rd --from %s%x --bytes 0x200' startaddr_str tot
  11.         messagebox cmd 'cmd'      
  12.         startaddr_start_int = startaddr_start_int + 512              
  13.     endwhile
  14.      
  15.  
dpena
Coach

Posts:
144
Joined: Thu Jul 09, 2009 6:14 pm
by dpena » Thu Jan 12, 2017 7:31 pm
Hi IshmaelCallMe,

:satisfied: :beer: :satisfied:

WOW!! Awesome... It works great.

Thank you Sir, for your coding expertise.

I will study your calculations and hopefully make sense of them.
Display posts from previous:
Sort by:

3 postsPage 1 of 1

Users browsing this forum: No registered users