Coding troubleshooting with Uvision5

Hey everyone,

I recently purchased an ADuC847 eval board, and am very green when it comes to coding in assembly and/or C. I have several questions when it comes to figuring out the code syntax, and small details which I'm most likely missing. I'm trying to figure out how to take three different analog measurements and output them (~1sec delay) in an ASCII character string such as (AxxxxxByyyyyCzzzzz). I've got the output looking like this so far: AxxxxxxByyyyyyCzzzzzz. If someone could advise me on how to reduce the x,y,z outputs from 6 to 5, hopefully without causing inaccurate readings, that would be great. 

The other issue I'm having is that I am struggling with turning on the other analog inputs of the device, or if I turn them on, its displaying the same measurement three times. The code that I have placed below is very basic, and was started with the example code that came with the software.

I've also tried to write a delay program, but insofar I've only got it to freeze after outputting the string. Thoughts? The code doesn't include an attempt to turn on the other analog inputs, I originally tried it in using only ASM51, but have since switched to C and am not sure how to proceed with accomplishing that task.

My code is as follows:  

#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <ctype.h>
#include <ADuC847.h> //Some of these include files may not be necessary

sbit LED = 0x0B4;

void delay(int);

void ADC_int () interrupt 6
LED ^= 1;
printf("A%bX%bX%bX",ADC0H,ADC0M,ADC0L); //This will output 21 ASCII digits.
printf("B%bX%bX%bX",ADC0H,ADC0M,ADC0L); //Needs to be reduced to 19 characters
printf("C%bX%bX%bX",ADC0H,ADC0M,ADC0L); //Need to reduce from 21 characters to 19

P3 ^= 0x10;
void delay(int length)
while (length >=0)
void main (void)
//Configure UART
PLLCON = 0x90;
T3CON = 0x82; //115200 Baud rate
T3FD = 0x2D;
SCON = 0x52;

ICON = 0x01; //Turn on IEXC1 source to drive RTD.
SF = 0x200;
ADC0CON1 = 0x22; //Full Buffer, Unipolar, 80mV range.
ADC0CON2 = 0x4A; //Refin+/-, Ain1->Ain2
EADC = 1; //Enable ADC Interrupt
EA = 1; //Enable Global Interrupts
ADCMODE = 0x23; // continuous conversion on Main channel on main channel

The following is the output:

The A,B,C are required as part of my task so I cannot simply rid my code of the output here.

I'll do what I can to answer any questions you all have. Thanks for your time.

Parents Reply Children
No data
More questions in this forum