| ??? 07/09/02 08:41 Read: times |
#25520 - RE: the ADC (lots of source code ahead) |
Hi Jeff,
Some comments: At some point you do: CLR P1.4 ; Set P1.4 low for the rest of the conversion. MOV R1, #8 ; Set register R1 to 8 counts. (8 bits) And then you do: Clock_8_Bits: MOV P1.4, C This is not only unnecessary, but dangerous as well. If the Carry was set, P1.4 will be high "for the rest of the conversion". Better delete that line. Then: Clock_ADC_In: MOV C, P1.4 MOV A, C RLC A You are trying to move a bit operand (the Carry) into a byte operand (the ACC). That's illegal, hence the error message. Again, this line should be deleted. The RLC A instruction will copy the value of the Carry into the ACC. By the way: this will read your data MSb first. If it should be LSb first, use RRC A MOV R2, A ; Place final recieved byte of information in R2. JNB R2, Light2On ; If R2 is 0, light 1 goes on. If R2 is higher than 0 (analog voltage higher than 0, other light is on.) R2 is not a bit operand, so the JNB instruction is illegal. Remember that the MOV instruction actually copies, so the value is still in the ACC. And the ACC can be easily tested: JNZ A, Light2On You found the missing ";" yourself :o) Regards, Rob. |
| Topic | Author | Date |
| the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
| RE: the ADC (lots of source code ahead) | 01/01/70 00:00 | |
RE: the ADC (lots of source code ahead) | 01/01/70 00:00 |



