Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

"Continuous" debugging

Status
Not open for further replies.

chris414

New Member
I'm trying to calibrate two inputs (a tilt sensor and and the integration of the output of a gyroscope) as the tilt sensor does not provide a linear output. If I run my microprocessor in debug mode I can see what value each input is, however this requires me to reset the processor, click play, rotate the platform I'm measuring and press pause. Then either I have to hold the platform perfectly still while I somehow write those values down, or I have to go through the whole process of resetting everything and starting again for my next reading... the point is it's taking a ridiculous amount of time.

Is there any way I can run my microprocessor so that I can watch certain variables as they update continuously, ie. so that I dont have to click stop / start every time? The only other way I can think of doing it is to write the value I want to read to a voltage on an analogue output pin... though I would think this would sacrifice some accuracy? What I really want at the end of all of this is a scatter plot of my tilt sensor vs the integration of my gyroscope.
 
Last edited:
Usually a simple UART output to the PC is used for semi-real time debugging. Some IDE's even have terminal program's built in just for this purpose.
 
1

Indeed outputting to serial is most of the time the solution for this. Sometimes, though, you need much faster data capture - for such cases a simple circular/finite RAM buffer works well. Define an array of X values and then update this array with every N measurements. The greater X the more time you can capture and the smaller N, the higher the resolution. Once you want to see how the data behaves, simply break and watch the array. You can even copy it to clipboard and then manually shove it into an excel spreadsheet for plotting.
 
Last edited:
Indeed outputting to serial is most of the time the solution for this. Sometimes, though, you need much faster data capture - for such cases a simple circular/finite RAM buffer works well.
Good suggestion. I have also used this. Usually to capture a short data sequence and logging starts at a specific trigger point.
 
I like to use a text LCD for "debugging" and often some LEDs. You can display whatever variables or system states as needed in real time on the LCD, or turn the LEDs on/off as code is executed to catch fast events.

That's one of the reasons I like the EasyPIC development boards, there's always an LCD available and there is also a LED on every PIC pin so any unused pins can instantly become debugging lights.
 
Another way to do this, if you don't need a high storage rate, is to store values in the flash program memory. You could store a value 10 times a second and even if you only have 1k of spare memory you can store 10 seconds worth. Most of the newer chips would probably have 8k or so spare. Once full you just read it back using your programmer. And, it's in machine readable format.

Mike.
 
Last edited:
That's not another way; that's Pavius' suggestion of a buffer. ;)

No, Pavius suggested a RAM buffer. I suggested a FLASH buffer. There is a much larger area of flash available than RAM. On an 18F1320 (fitted on the Junebug) there are 256 bytes of ram and 8k of flash.

Edit, I mentioned it because most people don't consider the flash memory as they consider it to be ROM.

Mike.
 
Last edited:
No, Pavius suggested a RAM buffer. I suggested a FLASH buffer. There is a much larger area of flash available than RAM. On an 18F1320 (fitted on the Junebug) there are 256 bytes of ram and 8k of flash.

Edit, I mentioned it because most people don't consider the flash memory as they consider it to be ROM.

Mike.

Ah. My mistake. Yes, that would be different.
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top