Simple programming help

Discussion in 'Programmer's Corner' started by Dolk, Oct 28, 2007.

  1. Dolk

    Thread Starter Member

    Sep 24, 2007
    10
    0
    I am a total noob when it comes to .asm, and i was wondering if i could get some help with it. I just need to make a basic delayed loop. Basicly it will turn on port 0.7 for 30 secs wait 2.5 mins and then turn on once again for 30 secs.

    The processor i am using is the 89LPC932.
    Here is the reg932.inc file needed. http://www.ece.umr.edu/courses/Intro/reg932.inc

    I appreciate all the help i can get.
     
  2. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    The key is a period of 30 seconds. Waiting one period is good for the port activation, and then 5 periods for the wait afterwards.

    Classically, a delay loop looks like:
    LDA 100h
    DELAY DEC A
     
  3. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    The key is a period of 30 seconds. Waiting one period is good for the port activation, and then 5 periods for the wait afterwards.

    Classically, a delay loop looks like:
    LDA 100h
    DELAY DEC A
    BNZ DELAY

    The time used in the loop depends on the number of iterations and the time it takes to execute each instruction. Instruction execution times are given in clock periods. It is possible to nest loops for longer delays. Eventually, you can get to 30 seconds (or even one second if you want to count 30 executions at a time). It's a bit tedious, but you get there.
     
  4. Dolk

    Thread Starter Member

    Sep 24, 2007
    10
    0
    so how would i get
    LDA 100h
    DELAY DEC A
    BNZ DELAY

    to work with port 0.7, running for 30 secs and then waiting for 2.5mins? remember noob ;)
     
  5. beenthere

    Retired Moderator

    Apr 20, 2004
    15,815
    282
    I can't help further. My programming has been on different processors. The manual on the processor you are using will describe in abundant detail how to use the ports, what registers are present, and so on. It will also go on at length about the instruction set. Lots of book time to get on top of all that.

    One tried-and-true method of getting into programming is to get somebody else's code and figure out how it works. Then you make it do what you want. This was not considered theft of IP back in old days.
     
Loading...