??? 07/19/06 12:33 Read: times |
#120572 - Well I'm confused! Responding to: ???'s previous message |
Rishab, you have not been able to describe your hardware connections to us. All we know is that P0..7 to the 8155 AD0..7 are reversed! What about ALE, *RD *WR,IO/M and *CE? You have mentioned that you have used P2.7 & 6 but not told us exactly how they are connected. If we assume you have P2.7 connected to *CE and P2.6 connected to IO/M then the addresses would work as follows: 0000h-3fffh ram 4000h-7fffh io One would most likely use the 8155 as a multiplexed bus device as the 8051 has a compatible bus. You could control ALE on the 8155 yourself, then you would have to output the address on P0, then toggle ALE, then read or write the data whilst controlling *RD & *WR via your code. This would be the harder way to do it unless you have a compelling reason to do so. In your code the line mov dptr,#0c0000h ;address of control word Has one too many '0's! As well as the wrong address. The control word to make PORTC output I think should be 30h as non bit reversed it is 0ch. This would be a write to address 4000h To write to PORTC register the address would be 40C0h. Use MOVX rather than MOVC. You cannot write using MOVC! For example: RIOT_CMD_STATUS equ 4000h RIOT_PORTC equ 40C0h mov dptr,#RIOT_CMD_STATUS mov a,#30h ;cmd for PORTC as output (bits are reversed) movx @dptr,a ;write to RIOT mov dptr,#RIOT_PORTC mov a,#0 movx @dptr,a You are not using a compiler, you are using an assembler. There are fundamental differences. Whilst we understand what you mean, it is always wise to use the correct terms so everyone understands. Hopefully this clear things up a little. |