This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Memory mapped ADC

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...

Parents
  • 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.

Reply
  • 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.

Children