| ??? 08/16/05 16:48 Read: times |
#99516 - week puzzle III |
Little Joe had a board with AT89C52 clocked at 24MHz, with a 62256-type 32Kx8bit static RAM attached, addresses A0-A7 from P0 via a 74LS573 latch (latched by ALE, /OE pin permanently grounded), addresses A8-A14 connected to P2.0-P2.6, data bus connected to P0; /CS connected to P2.7 (A15); /WE connected to /WR; /OE connected to /PSEN and /RD which are ANDed together via two 74LS00-gates (the first NANDs the signals together while the second inverts the result to get the required AND function). This should map the memory to addresses 8000h-FFFFh in both external data and code memory space; so that a program can be uploaded to the RAM and executed from it.
There is a green LED (OK) connected to P1.0 and a red LED (ERROR) to P1.1 both by cathodes, both anodes via series 470Ω resistor to VCC=5V. Little Joe reads 8052.com forum regularly, so he used also a three-legged reset generator. Little Joe wrote the following test: LED_OK EQU P1.0 LED_ERROR EQU P1.1 RAM EQU 8000h Test: mov dptr,#RAM ;set destination address mov r2,dph mov r3,dpl ;and store it mov dptr,#RAMTest ;set source address mov r7,#RAMTestEnd-RAMTest ;set counter Loop: clr a movc a,@a+dptr ;get source byte mov r6,a ;store it temporarily inc dptr ;advance source address mov r4,dph mov r5,dpl ;store source address mov dph,r2 mov dpl,r3 ;restore destination address movx @dptr,a ;store byte to destination movx a,@dptr ;readback byte from RAM xrl a,r6 ;test if stored in RAM correctly jnz Error inc dptr ;advance destination address mov r2,dph mov r3,dpl mov dph,r4 mov dpl,r5 ;exchange src/dest addresses djnz r7,Loop ;loop for all bytes ljmp RAM ;execute code in RAM Error: clr LED_ERROR ;in case of error, red LED lit sjmp Error ;and stay looping forever RAMTest: clr LED_OK ;turn on green LED ljmp RAMTest ;and stay looping forever RAMTestEnd: endLittle Joe assembled this program, burned it into AT89C52 using a device programmer. Upon powerup, BOTH LEDs turn immediately ON. What has happened? Jan Waclawek |
| Topic | Author | Date |
| week puzzle III | 01/01/70 00:00 | |
| Not getting into details... | 01/01/70 00:00 | |
| you do | 01/01/70 00:00 | |
| see this | 01/01/70 00:00 | |
| Well. . . | 01/01/70 00:00 | |
| let me try | 01/01/70 00:00 | |
| eh? | 01/01/70 00:00 | |
| I`m confused with A15 | 01/01/70 00:00 | |
| Whooops | 01/01/70 00:00 | |
| and I thought that was "the puzzle" | 01/01/70 00:00 | |
| sorry | 01/01/70 00:00 | |
| and I thought that was "the puzzle" | 01/01/70 00:00 | |
| another trouble | 01/01/70 00:00 | |
| And what's wrong with /CS? | 01/01/70 00:00 | |
| sorry, my mistake | 01/01/70 00:00 | |
| what does not happend? | 01/01/70 00:00 | |
| And...? | 01/01/70 00:00 | |
| explain | 01/01/70 00:00 | |
| And...? | 01/01/70 00:00 | |
| Answer for puzzle | 01/01/70 00:00 | |
| I doubt? | 01/01/70 00:00 | |
| I doubt | 01/01/70 00:00 | |
| I agree here | 01/01/70 00:00 | |
| I wonder | 01/01/70 00:00 | |
| autodetect | 01/01/70 00:00 | |
| /PSEN | 01/01/70 00:00 | |
| there is also flaw in the reasoning | 01/01/70 00:00 | |
| Lost inverter | 01/01/70 00:00 | |
| errta | 01/01/70 00:00 | |
| Questions | 01/01/70 00:00 | |
| answers to questions | 01/01/70 00:00 | |
| Timings | 01/01/70 00:00 | |
| Ex[plain A bit more please | 01/01/70 00:00 | |
| intel app note says | 01/01/70 00:00 | |
| I do | 01/01/70 00:00 | |
| re:EA | 01/01/70 00:00 | |
| yes no doubt about it | 01/01/70 00:00 | |
| reset device | 01/01/70 00:00 | |
| three legged | 01/01/70 00:00 | |
The solution | 01/01/70 00:00 |



