| ??? 05/13/00 18:21 Read: times |
#2661 - help with code? |
This program assembles ok but it does not seem to run properly on the evaluation board. I get a constant 5 volts out of the Txd pin on the board. When i run it througth the simm and configure the serial to go out to the com1 port instead of the screen, i can see the 3 channels on the scope. Any help would be appreciated.
;============================================================= ; Program Name : testrun4.asm ; ; Detailed Description of Application: This program will read three separate ; analog inputs from an accelerometer and input them into the ADuC812 to do ; an analog to digital conversion then output the signal to a radio after ; processing ; ; Author: Lance Fleming ; ; Hardware Notes: ; Analog Devices ADuC812 with an 8052 compatible core ; 11.0592 MHz internal Oscillator ;============================================================= $MOD52 ; VARIABLE DECLARATIONS Chx DATA 030h ; X channel stored in address 30 hex Chy DATA 031h ; Y channel stored in address 31 hex Chz DATA 032h ; Z channel stored in address 32 hex Chksum DATA 033h ; check sum stored in address 33 hex Tchx DATA 034H ; temporary storage of offset values plus Tchy DATA 035H Tchz DATA 036H ; START OF PROGRAM org 000h ; Execution Starts Here mov 0EFH,#0C0H ; set adccon1 register to enable A/D conversion ; and the timing of the A/D setb F0 ; flag for first time through loop set ; INITILIAZATION OF STACK POINTER ? mov SP,#02fh LOOP: ; start of loop ; SELECTION OF THE X CHANNEL mov 0D8H,#010H ; set adccon2 register for reading of channel 0(x) JB 0D8H.4, $ ; wait for A/D conversion mov Chx,0D9H ; store result of conversion ; check if this is the first time through and if it is goto the next channel JB F0,therex mov A,Chx subb A,Tchx add A,#128 mov Chx,A therex: ; SELECTION OF THE Y CHANNEL mov 0D8H,#011h ; set adccon2 register for reading of channel 1(y) JB 0D8h.4, $ ; wait for A/D conversion mov Chy,0D9H ; store result of conversion ; check if this is the first time through and if it is goto the next channel JB F0,therey mov A,Chy subb A,Tchy add A,#128 mov Chy,A therey: ; SELECTION OF THE Z CHANNEL mov 0D8H,#012h ; set adccon2 register for reading of channel 2(z) JB 0D8h.4,$ ; wait for A/D conversion mov Chz,0D9H ; store result of conversion ; check if this is the first time through and if it is goto temporary variables JB F0,therez mov A,Chz subb A,Tchz add A,#128 mov Chz,A therez: ; if first time through, store data in temporary variables and set first flag JNB F0,first mov Tchx,Chx mov Tchy,Chy mov Tchz,Chz first: clr F0 ;Set flag to 0 for not first time through ; calculate the checksum mov A,Chx add A,Chy add A,Chz mov Chksum,A ; configure serial port for transmission and its baud rate ; mov SCON,#00h setb SM1 ; 8 bit UART mode clr SM2 ; disable multiprocessor communication mov TMOD,#20h ; 8bit timer auto-reload mode mov PCON,#00h ; make sure that PCON.7 is not set for double baud rate ; calculate baud, value of TH1=256-((clock/384)/baud) ; =256-((11059200/384)/4800) ; =250 mov TH1,#250 ; 4800 baud rate setb TR1 ; start timer for serial communication ; NOTE: to set to 9600 baud, set the SMOD bit in the PCON SFR(PCON.7) ; SERIAL OUT X DATA clr TI ; be sure end of transmit flag is set to 0 clr REN ; make sure no receiving during transmission mov SBUF,#Chx ; output x data JNB TI, $ ; SERIAL OUT Y DATA clr TI ; be sure end of transmit flag is set to 0 clr REN ; make sure no receiving during transmission mov SBUF,#Chy ; output y data JNB TI, $ ; pause until transmit complete ; SERIAL OUT Z DATA clr TI ; be sure end of transmit flag is set to 0 clr REN ; make sure no receiving during transmission mov SBUF,#Chz ; output z data JNB TI, $ ; pause until transmit complete LJMP LOOP ; back to beginning of loop ; Subroutines ; [Put in Subroutine Code] end ; end of program |
| Topic | Author | Date |
| help with code? | 01/01/70 00:00 | |
| RE: help with code? | 01/01/70 00:00 | |
| RE: help with code? | 01/01/70 00:00 | |
| RE: help with code? | 01/01/70 00:00 | |
RE: help with code? | 01/01/70 00:00 |



