Hi Henrik,
I will follow ur advice and give it a try. If I have any problem I'll get back to you. I hope I am not taking ur precious time.
thanks for ur prompt reply.
regards
vu2iia
Hi Henrik,
I will follow ur advice and give it a try. If I have any problem I'll get back to you. I hope I am not taking ur precious time.
thanks for ur prompt reply.
regards
vu2iia
Hi Henrik,
Sorry to bother u again, but I am still new to PBP. I cant figure out how to view data stored in array on LCD in the format given in attatchment.
Please help me, if this work I can use the BCD data to change the frequecies of Third radio I have got. Entire idea is to recycle old radios in to something usefull.
below is my code . Pls bear with my stupid code.
Can u pls explain why have u declared array (mystring var byte (16) of 16.
Right now display shows some constant number " 253" when I choose R-10 radio in the PC software. If I choose another radio it doesnt show anything ecept LCD OK, which I have put in the code to check display.
'************************************************* *****************
@ device pic16F628A, intrc_osc_noclkout
trisb = %00000001
trisA = %11110011
include "modedefs.bas"
' Define LCD registers and bits
Define LCD_DREG PORTB
Define LCD_DBIT 4
Define LCD_RSREG PORTA
Define LCD_RSBIT 0
Define LCD_EREG PORTA
Define LCD_EBIT 1
DEFINE LCD_LINES 4 'Define using a 2 line LCD
DEFINE LCD_COMMANDUS 2000 'Define delay time between sending LCD commands
DEFINE LCD_DATAUS 50 'Define delay time between data sent.
'define osc 4
'* hser setup
DEFINE HSER_RCSTA 90h ' Enable serial port & continuous receive
DEFINE HSER_TXSTA 20h ' Enable transmit, BRGH = 0
DEFINE HSER_SPBRG 25 ' FOR 20MHZ 129 = 2400, 32=9600,25 @ 4 for 2400
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
DEFINE HSER_BAUD 2400
cnt var byte
CMCON = 7 ' PORTA is digital
Pause 100 ' Wait for LCD to startup
r10data VAR BYTE[16]
lcdout $FE,1
LCDOUT "LCD OK"
PAUSE 200
clear
loop:
' CANT FIGURE OUT HOW TO EXTRACT NECESSARY BCD INFO FROM ARRAY
HSERIN WAIT($52,$E0), STR r10data\16\$FD]
'for cnt = 1 to 16
lcdout $FE,1
LCDOUT $fe,$80,dec r10data
'LCDOUT $fe,$c0+cnt," ",dec r10data [cnt]
'next cnt
PAUSE 10
GOTO LOOP
End
'************************************************* **************
hoping for some relpy from u, please help.
regards
vu2iia
Hi,
This is probably not the best project for a beginner and I don't have any way to test what I write but lets see if we can figure it out. If any one else sees this please feel free to jump in!
Since I didn't know how many bytes the computer sends in the data-area and the spec-sheet you uploaded doesn't say I just took a number. You may need to adjust that to match.Can u pls explain why have u declared array (mystring var byte (16) of 16
1) Are you sure about the 2400baud? What about parity? 1 or 2 stopbits? The spec-sheet doesn't say....
2) You are running the PIC on its internal oscillator - this is usually not a good idea when using serial comms. I sugest you switch to a X-tal, atleast untill you have it working. Then you can try running on the internal oscillator.
3) Arrays are zero-indexed so if you have an array of 16bytes they are numbered 0-15.
/Henrik OlssonCode:x VAR Byte cnt VAR Byte r10Data VAR Byte[16] '************** Array and LCD-test ******************* 'This will fill the buffer with 65,66,67,68 etc which is ASCII for A,B,C,D etc for cnt=0 to 15 r10Data[cnt] = cnt + 65 NEXT cnt 'Then run thru the array and display on the LCD - should read: ABCDEFGHIJKLMNOP LCDOUT $FE,1 'Clear display for cnt= 0 to 15 LCDOUT r10Data[cnt] NEXT cnt Pause 1000 '***************************************************** loop: HSERIN [WAIT($52,$E0), STR r10data\16\$FD] LCDOUT $FE,1,"Data recieved" 'Show messege PAUSE 1000 'Wait.... FOR cnt = 0 to 15 LCDOUT DEC r10data[cnt], " " NEXT cnt PAUSE 1000 GOTO LOOP
Hi Henrik
Thank u my friend, I can see frequency send by PC program to radio on LCD via serial port. I have extracted necessary info from relevent array and I have got my project going. Last month I also made a simple repeater controller for 2m and repeater is working very well.
Once again thanks to you and to this wonderful forum.
LONG LIVE PBP.
regards
mahesh
vu2iia
Bookmarks