OWOUT dynamic memory addresses


Results 1 to 7 of 7

Threaded View

  1. #4
    Join Date
    Mar 2008
    Location
    Texas, USA
    Posts
    114


    Did you find this post helpful? Yes | No

    Default

    Code:
    mem_start = 1000h
    mem_end = 1060h
    
    for i = 1 to 60
        if i < 10 then OWOUT DQ, 1, [$CC, $F0, $0i, $10] ' I get an error trying to compile for $i
        if i >= 10 then OWOUT DQ, 1, [$CC, $F0, $i, $10] ' I get an error trying to compile for $i
    nexti
    Scott, as noted before, just use i, but given that, the code doesn't make sense. First, add a space between next and i in the nexti line (maybe just a type-o for this post). Second, except for the < and the >= in the IF statements, I don't see a difference in the execution of the IF's. Also, 60h is 96 decimal. Another change should be to start the i FOR NEXT loop with zero (0) and count to 96 for 60h being within memory sace (95 if this the begining of some other memory space (60h) - which would be normal as new areas in memory almost never start with a "1")

    I think what you want is this code. It will cycle through the i byte of the address, but I'm unclear about the byte order or the extent of your data addresses involved with this particular loop:
    Code:
    for i = 0 to 95  'Use 96 IF 60h IS part of the memory range, but I doubt it.
        OWOUT DQ, 1, [$CC, $F0, i, $10]
    next i
    It might be a good time to read up on hex-decimal-binary relationships (general, not just PBP docs). The caluclator found in Windows Accessories can be your friend (set to scientific mode).
    Last edited by JD123; - 17th March 2008 at 20:05.

Similar Threads

  1. Running Out of Programing Memory
    By rsocor01 in forum mel PIC BASIC Pro
    Replies: 15
    Last Post: - 31st March 2010, 08:26
  2. Need the code to write to a memory
    By Hamlet in forum General
    Replies: 0
    Last Post: - 20th August 2007, 00:22
  3. Replies: 4
    Last Post: - 2nd March 2007, 06:12
  4. sample code for M25P32
    By Pedro Santos in forum mel PIC BASIC Pro
    Replies: 1
    Last Post: - 9th January 2007, 02:37
  5. Use internal program memory like DATA memory
    By flotulopex in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 30th December 2006, 18:38

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