PDA

View Full Version : I2cwrite - I2cread



savnik
- 4th July 2006, 15:27
I have this:
I2CWRITE SDA,SCL,ADDR1,[HI,LO,$8E,BAND] 'Sending of the data to the module
in code and work.
BAND is : BAND VAR BYTE
If PLL>720 and PLL<2720 then BAND=$60 'Low range = 45 -> 170 MHz.
If PLL=>2720 and PLL<=7200 then BAND=$50 'Mid range = 170 -> 450 MHz.
If PLL>7200 and PLL<14240 then BAND=$30 'High range = 450 -> 890 MHz.

I want to add and the I2CREAD command to know if the PLL is Lock and to display on LCD.
I2CREAD SDA,SCL,ADDR2,[LOCK]
How;

mister_e
- 4th July 2006, 15:37
that will be far easier if you tell us wich PLL you're using :)

savnik
- 4th July 2006, 16:22
that will be far easier if you tell us wich PLL you're using :)
PIC16F84A AND TSA5511

mister_e
- 4th July 2006, 18:48
refering to table 2 of the datasheet


IF LOCK.6=1 then
LCDOUT $FE,1,"PLL in-lock"
endif

savnik
- 4th July 2006, 21:01
refering to table 2 of the datasheet


IF LOCK.6=1 then
LCDOUT $FE,1,"PLL in-lock"
endif

Thank you , it's work but show continues.
I want to show on first line of lcd after the frequency
like this : 100.3 MHZ LOCK
and if not lock to show
like this : 100.3 MHZ UNLOCK

mister_e
- 4th July 2006, 21:26
PBP manual, LCDOUT section



LCDOUT $FE,1,your frequency plah plah,"MHZ "
IF LOCK.6=1 then
LCDOUT "Lock "
else
LCDOUT "Unlock"
endif

savnik
- 4th July 2006, 22:28
PBP manual, LCDOUT section



LCDOUT $FE,1,your frequency plah plah,"MHZ "
IF LOCK.6=1 then
LCDOUT "Lock "
else
LCDOUT "Unlock"
endif

Thank you
I write this code and work:
LCDOUT $FE, 1 'Clear LCD screen
LCDOUT #F2 'post the other digits
LCDOUT "." 'post the comma
LCDOUT #F3 'post the Khz
LCDOUT " MHz "
IF LOCK.6=1 then
LCDOUT "LOCK"
else
LCDOUT "UNLOCK"
endif
LCDOUT $FE,$C0
LCDOUT "PLL FM 87.5-108 "
Return

But i want the word LOCK or UNLOCK to begin at 13th position
I try this LCDOUT $FE, $80 +13
but it's not work

mister_e
- 5th July 2006, 00:41
odd... it's working here..

LCDOUT $FE,($80+13),"lock"

savnik
- 5th July 2006, 01:12
odd... it's working here..

LCDOUT $FE,($80+13),"lock"
Thank you very much.
All work fine.
And the last question.
When the PLL is unlock shows LOCK and no UNLOCK, changes only if I push one button. Rather it wants one command that it would make I check the each situation of PLL little.
Or when I close the power and open again