View previous topic :: View next topic |
Author |
Message |
DJD XTREEM
Joined: 24 Jun 2004 Posts: 190 Location: 127.0.0.1
|
Posted: Thu Jun 24, 2004 7:45 pm Post subject: 90S2343 with IR input. |
|
|
As i read from the Manuel of Peter Dams. To recieve RC5 you need to get the data pin of the reciever on one of the timers of the AVR. Something like OC1.
Only i want to use an 90S2343 with IR. But when i try to set those interupt the compiler gives me errors..
The first error begins with :: ' this is a test programm
So he doesn't reconise the text that are written after the special marks that should give us the option to read more info in our script file..
Then he gives a second error on the interrupt.
This was done with the sample file of bascom called: RC5.bas
I changed the port ID from Portd.2 to Portb.2 because we only have port B's on the 90s2343 ..
So anyone has an idea what this could be?? Or is it the compiler that has some misconfiguring or problems.. _________________ Bascom AVR 1.11.8.8 full version
STK500 Programmer
ISP Programmer |
|
Back to top |
|
|
albertsm
Joined: 09 Apr 2004 Posts: 5913 Location: Holland
|
Posted: Fri Jun 25, 2004 11:51 am Post subject: |
|
|
Hi,
You need to remove PRINT statements as the 2343 has no UART.
Here is the modified code :
'-------------------------------------------------------------------
' RC5.BAS
' (c) 1999-2003 MCS Electronics
' based on Atmel AVR410 application note
'-------------------------------------------------------------------
'use byte library for smaller code
$lib "mcsbyte.lbx"
'This example shows how to decode RC5 remote control signals
'with a SFH506-35 IR receiver.
'Connect to input to PIND.2 for this example
'The GETRC5 function uses TIMER0 and the TIMER0 interrupt.
'The TIMER0 settings are restored however so only the interrupt can not
'be used anymore for other tasks
'tell the compiler which pin we want to use for the receiver input
Config Rc5 = Pinb.2
'the interrupt routine is inserted automatic but we need to make it occur
'so enable the interrupts
Enable Interrupts
'reserve space for variables
Dim Address As Byte , Command As Byte
'Print "Waiting for RC5..."
Do
'now check if a key on the remote is pressed
'Note that at startup all pins are set for INPUT
'so we dont set the direction here
'If the pins is used for other input just unremark the next line
'Config Pind.2 = Input
Getrc5(address , Command)
'we check for the TV address and that is 0
If Address = 0 Then
'clear the toggle bit
'the toggle bit toggles on each new received command
'toggle bit is bit 7. Extended RC5 bit is in bit 6
Command = Command And &B01111111
' Print Address ; " " ; Command
End If
Loop
End _________________ Mark |
|
Back to top |
|
|
DJD XTREEM
Joined: 24 Jun 2004 Posts: 190 Location: 127.0.0.1
|
Posted: Sat Aug 07, 2004 6:09 pm Post subject: |
|
|
Made the following code for my 2313 but now it have to be converted to 2343.. Already marked the print statment to solve some problems.. But now it still have 1 error:
Error 1 line 39: Unknown statement [.equ not found for PIND]
This is the code:
Code: | Config Portb = Output
Config Rc5 = Pind.4
Enable Interrupts
Dim Baddress As Byte
Dim Bcommand As Integer
Portb = 255 'had to do this with the AVR Development board
Do
Getrc5(baddress , Bcommand) 'recieving data from ir eye
'-----------------------------------------------------
'|Starting of build-in code analyser for RC5
'|Baddress and Bcommand can be readout with terminal programm
If Baddress < 255 Then '< otherwise terminal output will be continue 255 255 when no data send
Print Baddress ; " " ; Bcommand 'gives readout on terminal
End If
If Baddress = 21 Then 'checks for valid address
Select Case Bcommand 'set or resets the output pins when there is a command
Case 128 : Set Portb.0
Case 144 : Reset Portb.0
Case 129 : Set Portb.1
Case 145 : Reset Portb.1
Case 130 : Set Portb.2
Case 146 : Reset Portb.2
Case 131 : Set Portb.3
Case 147 : Reset Portb.3
End Select
End If
Loop |
_________________ Bascom AVR 1.11.8.8 full version
STK500 Programmer
ISP Programmer |
|
Back to top |
|
|
DJD XTREEM
Joined: 24 Jun 2004 Posts: 190 Location: 127.0.0.1
|
Posted: Mon Aug 09, 2004 1:49 pm Post subject: |
|
|
Found the problem! I forgot to set the IR input from PinD.4 to PinB.4
I forgot that the 2343 have only a B port.. instead of D port..
It's only pitty that i can't use the print staement.. But well just pickup those IR codes with a 2313.. _________________ Bascom AVR 1.11.8.8 full version
STK500 Programmer
ISP Programmer |
|
Back to top |
|
|
DJD XTREEM
Joined: 24 Jun 2004 Posts: 190 Location: 127.0.0.1
|
Posted: Wed Aug 18, 2004 12:39 pm Post subject: |
|
|
Problem not solved..
Compilations goes good.. Only in hardware it doesn't work..
Could it be the configuration of the ports?? Because i set portb = output.. and then portb.4 as input.. Tryed some options but nothing works right..
also the 90s2343 has to run on internal clock.. But not shure it even runs ..
Bascom reconised the chip as Attiny22 _________________ Bascom AVR 1.11.8.8 full version
STK500 Programmer
ISP Programmer |
|
Back to top |
|
|
DJD XTREEM
Joined: 24 Jun 2004 Posts: 190 Location: 127.0.0.1
|
Posted: Wed Aug 18, 2004 2:23 pm Post subject: |
|
|
Allright found out to fuse the internal oscilator.. Only it doesn't work yet..
i don't understand how to get that chip working with my code.. _________________ Bascom AVR 1.11.8.8 full version
STK500 Programmer
ISP Programmer |
|
Back to top |
|
|
|