Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

NEEd help in programming mc9s08qg8 as an Analog to digital c

Status
Not open for further replies.

sexy1234

Newbie level 2
Joined
Jan 27, 2009
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,306
programming mc9s08qg8

HI,

Can any one send me the code to programe mc9s08q8 an an analog to digital converter
 

Re: programming mc9s08qg8

Dear Sexy1234,
hi, fine the attachment, then let me know the status.

void PORT_INIT(void);
void ADC_INIT(void);
int a0=0;
void main(void)
{ int b0=0;
PORT_INIT();
ADC_INIT();
EnableInterrupts;

for(;;)
{ for(b0=0;b0<3000;b0++);
PTBD_PTBD7=~PTBD_PTBD7;
__RESET_WATCHDOG();
}
}

void PORT_INIT(void)
{ PTBDD = 0xFF; // all Pins are Output pins
PTBD = 0xFF; // all pins Initial condition logic'0'
PTBPE = 0x00; // desiable the all pull ups for the port(B)

}

void ADC_INIT(void)
{ PTADD_PTADD1=0; // PTA's 1st pin as a input pin (for ADC)
ADCCFG =0x40; // high Speed, divided 4 Input CLK, short sample time and 8-bit conv mode
ADCSC2 =0x00; // software trigger
ADCSC1 =0x41; // Interrupt (AIEN)enable and continuous conversion

}
interrupt 19 void ADC_ISR(void)
{ a0=ADCRL; // Read the 8-Bit ADC value
if(a0>60)
{ PTBD_PTBD6=~PTBD_PTBD6; // routine statements
a0=0; // continues....
}
ADCSC1 =0x41; // Clear the COCO Flag after complete the interupt routine
}

this is
Apple
 
Hi.
there was a problem when i copied the code and tried to run it.
i dint understand what the interrupt 19 was for.
can anyone please tell me more about this coding for MC9S08QG8.
i need a code for ADC.
reply as soon as possible.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top