Support and General Use > Hardware
H120 remote control
bonapardo:
Once more, thanks again. My approach will be to build your circuit first, get it working then make the LCD amendments. I managed to get hold of a non-LCD remote so I have a reference for obtaining the appropriate LCD resistance values. I'm a software developer by trade so as well as creating the remote itself, I'm looking forward to programming my first microcontroller.
I'll keep this thread updated with my progress and hopefully at some point will have an LCD circuit diagram to add to your project page...
bonapardo:
Still on a bit of a learning curve, with the basics of AVR programming in addition to getting my head around circuits in general.
At the weekend, I had a bit of trouble recognising the ATMEL chip (in my case, the ATTiny2313) in circuit, so I ended up creating a separate breadboard circuit to do the programming, which now seems to flash the chip as expected (with PonyProg).
I had a couple of questions about the circuit but tidied up my breadboard and it all makes a lot more sense now. However, I do have a quick question about the code...
When compiling (using the tools in WinAVR), I get the following errors:
Compiling C: rc5.c
avr-gcc -c -mmcu=attiny2313 -I. -gdwarf-2 -DF_CPU=8000000UL -Os -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums -Wall -Wstrict-prototypes -Wa,-adhlns=./rc5.lst -std=gnu99 -MMD -MP -MF .dep/rc5.o.d rc5.c -o rc5.o
rc5.c: In function '__vector_6':
rc5.c:35: error: expected ')' before numeric constant
rc5.c:44: error: expected ')' before numeric constant
rc5.c:47: error: expected ')' before numeric constant
make.exe: *** [rc5.o] Error 1
This is the code section:
35] if( ++rc5_time > PULSE_MAX ){ /* count pulse time */
if( !(tmp & 0x4000) && tmp & 0x2000 ) /* only if 14 bits received */
rc5_data = tmp;
tmp = 0;
}
if( (rc5_bit ^ xRC5_IN) & 1<<xRC5 ){ /* change detect */
rc5_bit = ~rc5_bit; /* 0x00 -> 0xFF -> 0x00 */
44] if( rc5_time < PULSE_MIN ) /* to short */
tmp = 0;
47] if( !tmp || rc5_time > PULSE_1_2 ){ /* start or long pulse time */
if( !(tmp & 0x4000) ) /* not to many bits */
tmp <<= 1; /* shift */
if( !(rc5_bit & 1<<xRC5) ) /* inverted bit */
tmp |= 1; /* insert new bit */
Seems to be related to the PULSE_ constants. When I replaced these with zeros, I was able to compile. If their values are dependent on output from the IC, do the constants need to be initialised/instantiated before compilation? Could it be I need slightly different code for the ATTiny? Ill try to compile for the chip in your circuit tomorrow (I've read they should be pretty much interchangeable).
Thanks again, I'm nearly there!
Post Merge: July 19, 2011, 05:57:43 AMI installed a different version of WinAVR and can now compile...
bonapardo:
My chip has been flashed (in circuit this time). The hex file has been verified through PonyProg.
However, I'm not getting any response from my Hauppauge remote. The remote and its transport buttons definitely work, I tested using WinTV and its integration with media players on my PC.
From looking at the code, I expect the LED to light up when I press a button. I even created a second circuit, stripped down to just the Receiver, LED and associated resistors. That doesn't seem to work either (although admittedly I'm not sure if removing the other elements breaks the circuit as a whole and did not amend the code, simply detached components from the circuit). I also tested the IR reciever and that the circuit is being fed the approx 3.3V from the iRiver and both seem to be fine.
Do you have any advice on testing my chip? I can't afford AVR Dragon just for this project, but it would be helpful if I could work out whether anything is being processed in my chip. Would it be possible to fry the chip with 6V (I did connect four 1.5V batteries at one point)? Is it possible to have a chip that flashes but does not run the code it's been flashed with? I have four chips I can test with, two of which so far do not seem to be running the code.
Tonight, as a test of the chip itself, I will attempt a much simpler program to simply light an LED. If that works, I'll return to your project to strip out all code not related to receiver and LED and re-test that. If you have any advice it would be much appreciated. I have tried to use a number of simulation tools but the ones I've looked at do not simulate the ATTiny2313 specifically and end up giving me compilation errors.
So close, but so far..!
bluebrother:
Oh, I forgot to document the fuse settings -- you need to change the controller to use 8MHz instead of the default 1MHz. I'll check / update the documentation later today (no access to the circuit right now).
Sorry for the problems caused :(
bonapardo:
No problem at all! I've tried out a number of IDEs (I just installed AVR Studio 5 which uses Visual Studio 2010 - nice for Microsoft heads like me) and been learning about all sorts of other things along the way so it has been far from a waste of time by any means. These microcontrollers are inspiring plenty of other ideas - if I'm not careful, soon I'll be controlling my curtains via an ATMEL chip! I do have another IR project I'll want to complete after this one to control a DC motor. If that ever happens, I'll create a gitHub project for it and give you the props you deserve!
I'll try the fuse change later...
Post Merge: July 20, 2011, 03:20:37 PMThanks for the fuse tip. I just unprogrammed the CKDIV8 fuse and now I get the LED lighting up whenever I press a button. So I know the chip is fine and I'm flashing it correctly. Nice. However, the LED remains on and I have to press again to turn it off (rather than turning off when I release). All buttons have the same effect and can disable the LED if lit up by another button. I'm not getting any response from the iRiver at the moment.
I'm about to make sure all other ATTiny defaults remain in case I've accidentally overwritten some but if you have any ideas...
Your help is VERY much appreciated!
(also, as I'm in a position to test the circuit and program, please let me know if you'd prefer my enquiries to go through the project page from now on)
Post Merge: July 20, 2011, 03:30:13 PMUPDATE: Defaults appear fine...
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version