[bascom] RC5


From "M.C.Alberts" <mark@mcselec.com>
Date Wed, 29 Sep 1999 01:17:49 +0200
Organization MCS Electronics

Hi all,

I checked the RC5 and attached this very small example.
I found out that by reversing the tcon bit you get the 21 21.
This is caused by the fact that the SFH506 is inverting the signals.
I tested it with S8252 and SFH506-36 with 11.0 etc. MHz. There was no 12
MHz Xtal to test it with but it should work also. I will test it later
with 12 MHz.
The remote was 'UNIVERSAL ZONE R324' and 'PHILIPS UNIVERSAL'
And I hope than in the mean time it will work for all of you!

Best regards,
Mark Alberts


Brent Nelson wrote:
> 
> Hi Micheal,
> 
>  I tried out your sample program , and I get no errors, and using the 
> simulator the lcd was updating and displaying   124.50Deg. C
> 
> Do you have the internal Ram setting correct?
> 
> To put the lcd on a data bus you must use  the $LCD = address directive. 
> Bascom is using the settings found in the IDE.
> 
> Bascom is using the default settings so you only have 64 bytes of ram -  
> you have specify a processor or change the setting in the IDE.
> 
> Have Fun ,
> 
> Brent
> 
> "Michael W. Akers" wrote:
> 
> > Mark,
> > Have a section of code that is bothering me, well two actually, that I 
> > need some advice on.
> >
> > The first is:
> > Dim Dispbuff As String * 40                                               
> >            <- I get an out of memory error. If I set it for 7 the 
> > compiler is happy
> >
> > This is for use in the second problem spot.
> > The next is:
> >
> > ' Create temperature word
> > '   Put Lm75high in high byte position in Lm75temp word.
> >     mov {Lm75temp+1},{Lm75high}
> > '   Put Lm75low in low byte position in Lm75temp word.
> >     mov {Lm75temp},{Lm75low}
> > ' Now strip unused lower bits (least significant 7 bits)
> >     Rotate Lm75temp , Right , 7
> >     Dispval = Lm75temp * 0.5                                              
> >            <- Every thing works fine to here
> >     Dispbuff = Fusing(dispval , ###.##)                                   
> >         <- But program Stops execution here!!!
> > ' Now print the temp to the LCD
> >     Cls                                                                   
> >                            <- this part of the code never executes.
> >     Lcd Dispbuff ; "Deg. C"                                               
> >                <-
> >
> > With Lm75high set to $B01111100 and Lm75low set to &B10000000 the final 
> > result is 124.5 Deg. C if I have LCD Dispval ; "Deg. C" it prints out 
> > 124.500000 Deg.  On the simulated LCD.
> >
> > But when using Fusing everything halts!
> > Any Ideas?
> >
> > Michael Akers
> >
> > P.S. Here is the full program. (I'm helping Anders L. with accessing the 
> > LM75 using I2C.
> > '------------------------------------------------------------------------------
> > ' Program Name           : lm75read.bas
> > ' Program Date           : September 26,1999
> > ' Program Written By     : Michael W. Akers
> > '                          3800 Vineyard Ave. Apt. #E
> > '                          Pleasanton, California 94566
> > '                          Voice: +1 925 484 4750
> > '                          Email: mwakers@home.com
> > ' Program Purpose        : This program will demonstrate how to interface 
> > to,
> > '                          and communicate With The National 
> > Semiconductor LM75
> > '                          Digital Temperature Sensor.
> > '------------------------------------------------------------------------------
> > ' Programmer           Date        Comments
> > ' -------------------  ----------  
> > --------------------------------------------
> > ' Michael Akers        09/26/1999  Initial creation of this program.
> > ' Brent Nelson         09/27/1999  Usage uf assemble routines for 
> > byte/word
> > '                                  manipulation. Reduces resource 
> > requirements.
> > '------------------------------------------------------------------------------
> > ' Define all subroutines.
> > ' Define variables and constants
> >     Dim Lm75temp As Word
> >     Dim Lm75write As Byte
> >     Dim Lm75read As Byte
> >     Dim Lm75high As Byte
> >     Dim Lm75low As Byte
> >     Dim Dispval As Single
> >     Dim Dispbuff As String * 40
> >
> > ' Define configurations
> >     Config Scl = P3.5
> >     Config Sda = P3.7
> >     Config I2cdelay = 1
> >     Config Lcd = 40 * 4
> > '   Assumption is that the 89C2051 uses Port1 to communicate with the LCD.
> > ' Define Port and pin presets.
> > ' Initialize variables as needed.
> >     Lm75write = &B10010000
> >     Lm75read = &B10010001
> >     Lm75temp = 0
> > ' Program start
> > Start:
> > ' Gather the temperature data from the LM75.
> > '   Start the I2C system.
> >     I2cstart
> > '   Place the device in readback mode.
> >     I2cwbyte Lm75read
> > '   Read the High Byte. And ACK.
> >     I2crbyte Lm75high , 8
> > '   Read the Low Byte. And NACK.
> >     I2crbyte Lm75low , 9
> > '   Stop the I2C system.
> >     I2cstop
> > ' This code section to be removed when compiling for actual device.
> >     Lm75high = &B01111100
> >     Lm75low = &B10000000
> > ' Create temperature word
> > '   Put Lm75high in high byte position in Lm75temp word.
> >     mov {Lm75temp+1},{Lm75high}
> > '   Put Lm75low in low byte position in Lm75temp word.
> >     mov {Lm75temp},{Lm75low}
> > ' Now strip unused lower bits (least significant 7 bits)
> >     Rotate Lm75temp , Right , 7
> >     Dispval = Lm75temp * 0.5
> >     Dispbuff = Fusing(dispval , ###.##)
> > ' Now print the temp to the LCD
> >     Cls
> >     Lcd Dispbuff ; "Deg. C"
> > Goto Start

Attachment: Rc5.bas
Description: application/unknown-content-type-bas_auto_file