Forum Replies Created
-
AuthorPosts
-
MichaelKeymaster
You 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.
MichaelKeymasterIf 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.
MichaelKeymasterI 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 #2006MichaelKeymasterThe 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 #2003MichaelKeymasterThe 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 #1999MichaelKeymasterAbsolute 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 #1996MichaelKeymasterThere 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 #1991MichaelKeymasterwhat 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 #1990MichaelKeymasterYou 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 #1984MichaelKeymasterAre 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.
MichaelKeymasterYou need to set the SYNC SELECT jumper to the D9 position so that the Arduino generates the sync signal.
MichaelKeymasterThe 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.
MichaelKeymasterI think you’ll have no problem adapting the games to different pins for the buttons. Just look at the code, you can do it.
MichaelKeymasterI don’t know where you got that code, but it’s just wrong. There is no start_render or print_str methods in the API.
Download the most current TVout from the web site and look at the examples and the API.MichaelKeymasterI don’t understand your design. Are you trying to do VGA or Composite video using TVOut?
TVOut generates the signal on digital pins 7 and 9. You don’t even have those pins connected in your design. How did you expect it to work if you didn’t connect the pins?I just followed the design that the TVout guy proposed, except used a 330 ohm instead of a 470 ohm. I also put a diode on each line. The 75 ohm resistor is generally not needed because there is 75 ohms of resistance in the TV between the composite input and ground.
The details of how to use TVOut are here: http://code.google.com/p/arduino-tvout/
-
AuthorPosts