| ??? 05/09/00 15:31 Read: times |
#2608 - begginer in need of help |
This is my first assembler project and I have come accross a problem that I cannot seem to figure out. My program takes 3 analog inputs from a tri-axial accelerometer and inputs them to a aduc812 that does an a to d conversion then serials the seperate channels out through the Txd pin. The problem I am having is that I am using a variable called first that is set to 1 at the begging of the program to tell if it is the first time through the program loop. In the middle of the progarm I set first to 0 before it checks the analog input a second time so that the progarm knows that it is not the first time through the loop. The only problem is that the program does set first to 1 but for some reason it is not changeing first to 0 when I redifine it later in the progarm. The program assembled fine and when I single step through it everything else works, but it dose not redifine first to 0. The aduc812 has an 8052 compatible core and I am using the $mod52 control at the beggining of the program and the variable first is initialized to 1 before the progarm starts its loop to read the analog inputs. Why is first not being redifined to 0? Can someone give me any suggestions please.
Here is a code example: $mod52 ;VARIABLE DECLARATIONS Chx DATA 030H ;x channel stored in address 30 hex . (DECLARATION OF OTHER VARIABLES) . . First SET 1 ; flag for first time through loop ; START PROGRAM org 00h . (SET REGISTERS FOR A/D CONVERSION ETC.) . Loop: if (first) mov Tchx,Chx mov Tchy,Chy mov Tchz,Chz endif First SET 0 ;CALCULATE CHECKSUM ;SET SERIAL PORT FOR TRANSMISSION OF DATA ;OUTPUT DATA ;BACK TO BEGGING OF LOOP |
| Topic | Author | Date |
| begginer in need of help | 01/01/70 00:00 | |
| RE: begginer in need of help | 01/01/70 00:00 | |
RE: begginer in need of help | 01/01/70 00:00 |



