View previous topic :: View next topic |
Author |
Message |
PCM programmer
Joined: 06 Sep 2003 Posts: 21708
|
|
Posted: Sun Oct 27, 2019 1:58 pm |
|
|
I would like to know how he is displaying the result. Is he using printf ?
Or a watch window with the ICD debugger ? Details on this are needed. |
|
|
matthewsachs
Joined: 19 Jun 2016 Posts: 22
|
|
Posted: Sun Oct 27, 2019 5:21 pm |
|
|
PCM programmer wrote: | I would like to know how he is displaying the result. Is he using printf ?
Or a watch window with the ICD debugger ? Details on this are needed. |
The board I am working on has an FTDI device so I do this
Code: |
int16 FLOW_A_SCALE_FACTOR = 7371L;
int16 ANA_FLOW = 0L;
int16 ANA_ADC = 0L;
void main()
{
while(TRUE)
{
set_adc_channel(1);
delay_us(10);
ANA_ADC = read_adc();
delay_us(10);
ANA_FLOW = ADCtoFLOW(ANA_ADC, FLOW_A_SCALE_FACTOR);
printf(usb_forward,"Analog A RAW ADC: %lu \r\n", ANA_ADC);
printf(usb_forward,"Analog A FLOW_A_SCALE_FACTOR: %lu \r\n", FLOW_A_SCALE_FACTOR);
printf(usb_forward,"Analog A Flow Reading: %lu \r\n", ANA_FLOW);
delay_ms(500);
}
}
|
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19587
|
|
Posted: Sun Oct 27, 2019 11:27 pm |
|
|
Show the whole code. The processor header, includes etc..
Corruption, doesn't have to be random, it can simply be something
writing over something else. Hence the whole environment matters. |
|
|
|