??? 04/30/11 14:34 Read: times |
#182126 - Assembler way is difficult Responding to: ???'s previous message |
but has ultimate control over the microcontroller.
When the program has to stop running in the microcontroller, a simple way (not the only one) is to use the following STOP: sjmp $ or FIN: sjmp FIN about the MESSAGE: in order to display a string from code memory to lcd (having that the lower level routines are OK) may be like this MESSAGE: mov DPTR, #msga1 acall lcd_cputs MOV A,#84h acall LCD_COMMAND mov DPTR, #msga2 acall lcd_cputs MOV A, #C1h CALL LCD_COMMAND ;change line mov DPTR, #msga3 acall lcd_cputs RET ;--------------------------------------- lcd_cputs ----------------------------- ; Prints a null terminated string from code memory to lcd at current cursor ; position. Expects DPTR point to string start address in code memory. ;------------------------------------------------------------------------------- lcd_cputs: ; Uses A and DPTR, returns nothing push A ; lcd_cputsloop: ; clr A ; clear A as index movc A, @A+DPTR ; get first/next byte from string jz lcd_cputsexit ; if we get null 0x00 then finish acall WRITE_LCD_TEXT ; inc DPTR ; sjmp lcd_cputsloop ; loop for next byte until 0x00 lcd_cputsexit: ; pop A ; ret ; ;------------------------------------------------------------------------------- ; most Assemblers define a null terminated string as text included in double quotes ; msga1: DB "VAG." msga2: DB "TRIANTAFILOU_347" msga3: DB "FINGERPRINT_SENSOR" The ORG and END assembler directives are already explained by Per and Erik. |