Hi, I want to access the ADC0804 which is connected as the memory mapped device at 0x0001. Initially, I want check whether, address and data bus is working fine. For the same, I wrote the code as :::::Program 1::::: #include <p89v51rx2.h>
volatile unsigned char xdata *p = (char xdata *)0x0000; sbit LED = P3^0;
void main() { int j = 0;
while(1) { p[0] = 0x55; for(j=0; j<=2500; j++); LED = 0; p[1] = 0xAA; for(j = 0; j<=2500; j++); LED = 1; } }
:::::: Program 2:::::::::::::::: #include <p89v51rx2.h> #include <absacc.h>
volatile xdata at 0x1000 unsigned char config; volatile xdata at 0x1001 unsigned char config1; sbit LED = P3^0;
void main() { int j = 0; while(1) { config = 0xAA; for(j=0; j<=2500; j++); LED = 0; config1 = 0x55; for(j = 0; j<=2500; j++); LED = 1; } }
Program 1: LED Blinks but, there is no ALE or BUS transisitions. Program 2: Compiler through error that missing ; before 0x1000. This code I have refered from one of 8051 SBC webpage.
Kindly let me know what is the wrong? Is it, I need to set something in compiler? Iam using Keil uV4.
With thanks...
I am dropping this memory mapped I/O interface and planning to continoue with ports mapped interface as memory mapped interface requires more glu-logic with P89v51rd2 as ALE is not as per specificed in datasheet (might be something I am missing).
My understaning from ALE signal onboard is, ALE is low whenever there is external memory access happens (especially only during MOVX instruction execution) immediate after address latch and ALE is high rest of the time (During controller executes other instructions). If I use glue-logic in hardware I can perform required operation. But, since I am using smaller general purpose PCB, I cannot able to mount n number of device.
Thanks to all for your support...
You need to troubleshoot the hardware. There is definitely some problem with your hardware board. The IC works fine for memory mapped interface(32K RAM + more than 1KB IOs).
Hi Dhaval, The memory whatever you are referring will working with my hardware as well.only problem for me is, the way I want to use requires more glu-logic. I have seen the signal out of ALE pin directly using digital oscilloscope. Based on signal waveform only, I am telling I need more glue logic.
My understanding from the datasheet is different. That is, ALE will be always low and whenever MOVX is executed the ALE toggles. But, the signal out of controller, is different.
As per my understanding, the address should stay on latch 74ls373 until next MOVX is executed. but, it is not. my present hardware is very simple. I connected port0 to D inputs 74ls373, OE of LS373 is permanently connected low and ALE is connected to LE of LS373. So based on datasheet, at every time ALE toggles (getting write signal as well), LSB address should get latched on LS373. It is latching in my hardware as well, but, while executing next instruction, ALE goes high, the address latched disappears. Might be I am missing this controller specific C code to hold ALE low.
The present hardware is made just to see this functionality and interfacing ADC as next step.
However, I am planning to purchase, one more IC to conclude whether the controller, Iam using is defective or what.
I have done port mapped LCD and 4 push button interface design for one of the counting machine using same P89V51RD2 to display event and alarm based on number set in first attempt with out any issue (Software was not mine). Also, I have done other project with Analog device make ADuC841 (8052 core) project for internal ADC based data acqusition with external parallel flash memory interface to store data. So, my hardware never fails as it is not my first hardware project with 8051 and i am in this field for last 11 years with different processor based designs. only problem with me is very less knowledge in software.
There is no doubting on the amount of experience you have.
One more thing... I just tried with AT89C51RD2 in Proteus with out EXTRAM command as not supported by this device. There also, it is not toggling.... The reason for suspecting your hardware.
It cant be and should not be that the even after changing the controller IC, you dont get the ALE toggling correctly.
Try writing an assembly code and then check whether you get the results. And dont use keil for that purpose (that will remove your doubt on software. (use a windows command prompt based x51 tool chain. runs on windows-xp or lower versions only) use both the controllers.
Hi, I will try to check with x51 toolchain. But, I have to learn to do so... If you can refer some weblink will be helpful. However I am going to google for the same... Thanks....