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.

Configuring adc of tms470r1b1m controller

Status
Not open for further replies.

nikitha

Newbie level 2
Joined
Sep 1, 2010
Messages
2
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,301
im using tms470r1b1m controller for my project.i need an ADC for processing the analog input.

in iar workbench,i had configured the registers but the code is not working.

code is given below.plz give me a solution..........

#include <intrinsics.h>
#include "iotms470r1b1m.h"
#include "tms470r1b1m_bit_definitions.h"
#include <stdio.h>

void main(void)
{
int result;
PCR = CLKDIV_3; // ICLK = SYSCLK / 3
GCR = ZPLL_CLK_DIV_PRE_1; // SYSCLK = 8 x fOSC
PCR = PENABLE; // Enable peripherals


PLR = (PLOC3&0); //peripheral selects, The peripheral is internal
PPROT = (PPROT3&0); // peripheral selects,The peripheral is accessible in all modes
CLKCNTL = 0x00000020;


ADCR1 = PS_8; // ADCLK prescaler = 8
ADCR1 = COS;
ADCR2 |= G1_MODE; // Continuous Conversion
ADSR =0x0000; // Clears flag
ADEISR=0x0000; // event disabled
ADISR1 = 0x0020; // Convert group 1 = channel 5
ADISR2 = 0x0000; //grp2 disabled
ADCALR = 0x000; //no Calibration
ADSAMPEV = SEN; // ADCSAMP1 controls SW
ADSAMP1 = 62; // SW = 62+2
ADCR1 = ADC_EN; // Enable ADC


for (;;)
{

while (!GP1_END); // Wait for conversion to complete
{
}
result = ADDR5;
printf("RESULT is %d",result);
ADSR =0x0000;

}
}

when this code is executed in iar workbench and downloaded using jtag emulator, the ADC is not activated nor does it sets GP1_END bit to indicate the completion signal.hence the code never exits from the while loop.here input is given to channel 5.i couldn't identify the problem..

plz give me a solution.............
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top