how to take microcontroller program output as Log flie

Status
Not open for further replies.

gopintj

Member level 4
Joined
Sep 1, 2010
Messages
77
Helped
4
Reputation
8
Reaction score
4
Trophy points
1,298
Location
Thirukalukalukundra, Kanchipuram, Tamilnadu, India
Visit site
Activity points
1,953
how to take microcontroller program output as Log files

Hi all, Hope you all are fine.

I am currently involved in one task in which i need to know each and every operation that a microcontroller does. I though of using UART to print serial stream of characters when a particular event occurs. Using UART is one good method. But i would like to get this information without using any UART kind of stuffs.

For eg. If i send a byte of data to i2c device, i would like to know this information as logs. Does anyone have any idea to collect all this information and save them in a log file?
 

Hi,

Depends on how much info you want to keep.

A very simple way would be every time you send a byte of data out somewhere, be it I2C or Usart etc, then instruct it to increment a counter for that type of operation.
You could display the info on a lcd for instant feedback

USART OUT 234
I2C OUT 101
I2C IN 219
 

Re: how to take microcontroller program output as Log files


You can do this only with debugger, I dont know other option for this.

Over UART you will get only data what uC send.

You need define what particular you want to log?




For eg. If i send a byte of data to i2c device, i would like to know this information as logs. Does anyone have any idea to collect all this information and save them in a log file?

First define "all this information" then we will se what is possible to do.


You can log on SD Card, I2C/SPI EEPROMs, ....



MikroC I²C Library
https://www.mikroe.com/download/eng/documents/compilers/mikroc/pro/pic/help/i2c_library.htm

I2C code example:

Code:
void main(){
  ANSEL  = 0;                // Configure AN pins as digital I/O
  ANSELH = 0;
  PORTB = 0;
  TRISB = 0;                 // Configure PORTB as output

  I2C1_Init(100000);         // initialize I2C communication
  I2C1_Start();              // issue I2C start signal
  I2C1_Wr(0xA2);             // send byte via I2C  (device address + W)
  I2C1_Wr(2);                // send byte (address of EEPROM location)
  I2C1_Wr(0xAA);             // send data (data to be written)
  I2C1_Stop();               // issue I2C stop signal

  Delay_100ms();

  I2C1_Start();              // issue I2C start signal
  I2C1_Wr(0xA2);             // send byte via I2C  (device address + W)
  I2C1_Wr(2);                // send byte (data address)
  I2C1_Repeated_Start();     // issue I2C signal repeated start
  I2C1_Wr(0xA3);             // send byte (device address + R)
  PORTB = I2C1_Rd(0u);       // Read the data (NO acknowledge)
  I2C1_Stop();               // issue I2C stop signal
}

Best regards,
Peter
 

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…