Forum Replies Created
-
AuthorPosts
-
September 1, 2014 at 12:33 pm in reply to: Overlay will suddenly disappear when using Object Tracking #2015
Michael
KeymasterI think you’re just going to need to experiment and see what you can do. Just connect your PWM voltage to the A2 analog reference and see what happens.
Michael
KeymasterYou could write a program on the Arduino that listens to the serial port and writes the data to SRAM. And a program on a computer that writes the data to the serial port.
Michael
KeymasterYou cannot do Serial output in an interrupt service routine. Take that out.
The timer setup is done in AudioHacker.begin(). When timer1 overflows, the ISR is executed.You are going about this all wrong. Start with a working example program and adapt it to your needs. You are starting from scratch and are not declaring things right. Your variable address needs to be declared volatile because you are changing it in the ISR. Any variable changed within the context of an interrupt must be declared as volatile.
Michael
KeymasterIf you are going to change the value of aux in the ISR, you need to declare it to be volatile.
volatile int aux = 0;
You have some other problems with your code. You are reading a 12-bit value from the ADC, but only incrementing the address by 1. You need to increment by 2 if you are writing 2 bytes to SRAM.
If you want more efficient storage (required to get 10s at 18KHz) you will need to pack two 16-bit samples into 3 bytes using the function [tt:h3thdvvl]writeSRAMPacked[/tt:h3thdvvl]. See the example [tt:h3thdvvl]Sampler_12bit[/tt:h3thdvvl] for how to do this.
If you want 8-bit sampling, use [tt:h3thdvvl]readADC_8bit()[/tt:h3thdvvl] instead, and you can increment the memory address by one as you are now.
Michael
KeymasterI really cannot tell what you are trying to accomplish or why you cannot use an ISR in your solution. Are you trying to record audio? Your variable
signal
is unassigned, so your program seems to just write garbage to memory. Why?
August 24, 2014 at 2:34 pm in reply to: Overlay will suddenly disappear when using Object Tracking #2006Michael
KeymasterThe 10K pot controls the analog reference voltage for the comparator. PWM generates a square wave, not a voltage between 0-5V, unless you filter it with a cap. You could try using PWM on timer2 or timer0 with a filtering cap to generate an analog voltage, but I don’t think it would be very steady. Many people think that analogWrite generates an analog voltage, but it does not. PWM is a square wave.
August 20, 2014 at 12:28 am in reply to: Alternative firmware that remembers countdown duration #2003Michael
KeymasterThe directions are right in the code and above in this forum.
When holding down the red DET button, you can use the MIN and HOUR
buttons to increase the countdown time. To *decrease* the countdown
time, also press the ALARM button while holding down the DET button.
When you release the DET button, the countdown starts and this
countdown value is the new default. It is written to EEPROM and
is saved even if the power is disconnected.August 17, 2014 at 11:36 pm in reply to: Overlay-> Seeeduino done! ->Arduino MEGA done->Serial GPS #1999Michael
KeymasterAbsolute success! Very cool for such low end hardware. Great job!
August 17, 2014 at 7:15 pm in reply to: Overlay will suddenly disappear when using Object Tracking #1996Michael
KeymasterThere are ways to debug the ATmega328 MCU using JTAGICEmkII or Dragon programmers, but I have not done it. I typically use the old-school printing of info to the serial port in order to debug problems. You are right that breakpoints are going to destroy the ISR timing.
PLEASE understand that the Video Experimenter is a very inexpensive and relatively crude device — it’s just a sync separator and some clever code. Generating video from a $1.63 microcontroller requires a great deal of the microcontroller’s resources, so there are some real limitations to what you can do practically.
August 17, 2014 at 1:31 pm in reply to: Overlay-> Seeeduino done! ->Arduino MEGA done->Serial GPS #1991Michael
Keymasterwhat resolution are you trying to drive? To do overlay, you are not going to be able to do higher resolution than 128×96. At that resolution do things work?
August 17, 2014 at 1:28 pm in reply to: Overlay will suddenly disappear when using Object Tracking #1990Michael
KeymasterYou can write whatever diagnostic output you’d like out to the serial interface using pollserial. There’s no such concept as exceptions in embedded electronics though. It’s C code running on raw metal, so if your program is incorrect or if you blow the stack or stomp on memory, there’s no OS underneath you to tell you that. Make sense?
I’m not sure what’s wrong with your setup, but maybe your video source doesn’t give a clean sync signal.
August 16, 2014 at 6:44 pm in reply to: Overlay will suddenly disappear when using Object Tracking #1984Michael
KeymasterAre you trying to use the Serial library in your program? You cannot use it. You MUST use the pollserial library that comes with TVout if you want to print debugging info the the serial port.
Michael
KeymasterYou need to set the SYNC SELECT jumper to the D9 position so that the Arduino generates the sync signal.
Michael
KeymasterThe diodes prevent current from flowing from one pin to another. You have two pins generating signals and you are tying them together. If one pin is HIGH and the other LOW, then the LOW pin will sink current from the HIGH pin. Diodes are a good idea.
You don’t need pullup resistors on digital inputs if you use the internal pullups. I’m not sure why the internal pullups would not be sufficient.
Michael
KeymasterI think you’ll have no problem adapting the games to different pins for the buttons. Just look at the code, you can do it.
-
AuthorPosts