'Send_A_StringToMrLCDWith-Location' was not declared in this scope

Hi,
I am testing a code from:
https://newbiehack.com/MicrocontrollersADC10Bits.aspx
and the ERROR came:

  1. how it used int main(void)?
  2. how to convert it as void setup kind?
  3. the ERROR?
    Thanks
    Adam
#include <avr/io.h>
#include <stdlib.h>
#include <avr/interrupt.h>
#include "MrLCD.h"   ///// https://github.com/logicstick/newbieavr

int main(void)
{
  InitializeMrLCD();   //configure the ADC
  Send_A_StringToMrLCDWithLocation(1,1,"ADC Result:");
  
  ADCSRA |= 1 << ADPS2; // so the prescaler between 5-20, On the datasheet Table 85 select 16 is OK.
  //Enable a prescaler - determined by the internal/external clock
  //THE system has 1000000Hz, the ADC allow 50Hz-200Hz, 10000000/50000 =20; 10000000/200000=5;

  ADMUX |= 1 << ADLAR; //8-bit or 10-bit results LEST SHIFT OR RIGHT SHIFT
  ADMUX |= 1 << REFS0;
  ADCSRA |= 1 << ADIE; //Enable interrupts function in ADC
  ADCSRA |= 1 << ADEN; //Turn on the ADC feature

  sei();   //Enable the global interrupts

  ADCSRA |= 1 << ADSC; //start the first conversion

  // one more thing how to get reference???? datasheet ATmega32 p216??

  while (1)
  {
  }
}

//*******Add the interrupts routine and display the results

ISR(ADC_vect)
{
  uint8_t theLowADC = ADCL;
  uint16_t theTenBitResults = ADCH << 8 | theLowADC;
  Send_An_IntegerToMrLCD(13, 1, theTenBitResults, 4);

  ADCSRA |= 1 << ADSC; //start ANOTHER conversion

}

ERROR:

Arduino: 1.8.13 (Windows 7), Board: "Arduino Uno"

C:\Users\HUA.DELLV-PC\Documents\Arduino\ADC_C1\ADC_C1.ino: In function 'int main()':

ADC_C1:14:3: error: 'Send_A_StringToMrLCDWithLocation' was not declared in this scope

   Send_A_StringToMrLCDWithLocation(1,1,"ADC Result:");

   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

C:\Users\HUA.DELLV-PC\Documents\Arduino\ADC_C1\ADC_C1.ino: In function 'void __vector_21()':

ADC_C1:42:3: error: 'Send_An_IntegerToMrLCD' was not declared in this scope

   Send_An_IntegerToMrLCD(13, 1, theTenBitResults, 4);

   ^~~~~~~~~~~~~~~~~~~~~~

exit status 1

'Send_A_StringToMrLCDWithLocation' was not declared in this scope



This report would have more information with
"Show verbose output during compilation"
option enabled in File -> Preferences.

The code needs you to follow hte code steps above it to complete the sketch, the functions are listed there.

1 Like

Thanks.