| ??? 12/20/01 15:25 Read: times |
#17885 - Still Learning, Need some suggestions. |
Hi Everyone.
I think I'm learning a lot with all the documentation I read, and your help. The point: Im trying to build a program who sents a set of bytes via one pin of the P1. This means I need to send the first bit, and the second....till the last bit, and after that begin with the next byte. What I'm doing is putting those bytes in memory and then sending one by one to p1, rotating the accumulator. At this time I'm able to send the first byte ok, but I have some troubles with the rest of them. one question is: Can I store those fixed bytes somewhere in the eeprom?? (look at the label head1 on the code, I'm using a MOV because a didn't find yet a better way to do it, but this is code, not fixed data and I will lose some time to execute this part) Also I'm using an interrupt in order to reestart from the begining. So basicly this program will receive a clock pulse on p3.4 and with every 1 to 0 transition will send a bit. If the program receives an INT0 the program will restart from the begining. I think I'm doing something wrong with the HEAD1 label and forward instructions. Here is my code: CNT EQU 70H ;Byte count variable BIT EQU 69H ;Bit Count variable BYTE EQU 68H ;Temporary byte variable ORG 0000H JMP INICIO ORG 0003H ;INTERRUPT ROUTINE WILL RESTORE THE DATA FROM THE BEGINING MOV R0,#41H MOV BYTE,@R0 MOV BIT,#0H MOV A,BYTE RL A MOV BYTE,A RETI ORG 0030H ;MAIN PROGRAM INICIO: MOV BIT,#0H MOV R0,#41H MOV P3,#FFH MOV P1,#00H MOV BYTE,@R0 MOV IE,#81H ;ENABLE INT0 MOV TCON,#00H ;ENABLE LEVEL TRIGGER FOR INT0 HEAD1: MOV 41H,#B8H ;HERE IS THE LIST OF BYTES WE WILL SEND MOV 42H,#80H MOV 43H,#A6H MOV 44H,#10H MOV 45H,#DH MOV 46H,#7H MOV 47H,#E1H MOV 48H,#4BH MOV 49H,#6H MOV 50H,#4CH MOV 51H,#32H MOV 52H,#59H MOV 53H,#FFH CICLO: JB P3.4, CICLO ;wait a falling edge on P3.0 NOP MOV A,BYTE MOV P1, A MOV BYTE,A INC BIT MOV A,BIT CJNE A,#07H,CICLO2 MOV BIT,#0H INC R0 MOV BYTE,@R0 CJNE R0,#BH,CICLO2 MOV R0,41H MOV BYTE,@R0 MOV A,BYTE RR A MOV BYTE,A CICLO2: JNB P3.4, CICLO2 ; wait leading edge on P3.0 MOV A,BYTE RL A MOV BYTE,A NOP AJMP CICLO |
| Topic | Author | Date |
| Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestions. | 01/01/70 00:00 | |
| RE: Still Learning, Need some suggestion | 01/01/70 00:00 | |
RE: Still Learning, Need some suggestion | 01/01/70 00:00 |



