Sprintf and Sparkfun's OpenLog

1 post / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello!

I'm having some problems with the function Sprintf and the OpenLog from Sparkfun. Here's whats happening:

I'm using an ATMega 644 in a data aquisition module, the microcontroller acquires various signals from different sensors through the ADC then it composes a "message"and sends to the OpenLog by the USART module so all the data can be stored in a 512MB microSD.

Also I'm using the 16bit timer to implement a frequency divider so I can ajust the aquisition period.

The problem happens when I try to use the function sprint to compose the text that will be written to the SD. In the code below, if I comment the part that acquire the second temperature sensor measurament, the text is composed and the sent to the SD. But if I uncomment this part, the microcontroller simply stop working and get stuck.

I've made some tests and discovered that the sprintf has a limit in the number o characters that can be send at once. Even if divide the sending of the message, the error continues.

What can be done ? There is another function that can convert integers number from the ADC into text so I can send to the SD ? I'm doing something wrong ?

Sorry for any English mistakes. Hope I made myself clear.

P.S.: I've had to upload the code in a PDF file because the forum keeps returning a 400 error when I try to post the text and the code together.

Attachment(s):