Keyboard PIC Terminal (SERIN, SEROUT & LCD)

Gavinn

Member
Hi all,

I've been thinking of this project for a while and only got round to building some HW to start testing it at the weekend and need some advice to move it forward. I've seen lots of topics about KEYIN, LCD, SERIN and SEROUT but nothing combining them all.

What I want to do: I'm playing a lot with amateur radio type PICAXE projects and more specifically in the new arena of D-Star. D-Star allows 1200baud serial data to be transferred simultaneously with speech although the radio interface is either 9600 or 38400 baud but don't worry about this just now. One of the common programs for this 1200 baud stream is simple texting or messaging. I would like to have a PIC with a keyboard interface, and SERIN and SEROUT to the D-Star radio and an LCD (4 lines?) to display incoming and typed serial messages. Basically remove the PC.

As some PICs support KEYIN and SEROUT I thought I'd have a go and start testing with an 18x at the weekend and low and behold I've got a program which can read the key presses on the keyboard and send them out using SEROUT and the D-Star radio transmits it (D-Star radios support auto TX when something is seen on the serial interface). I've not done anything with an LCD yet.

The problem is it transmits only one character at a time and I want to buffer anything typed on the keyboard, say upto 160 characters and then send them out in one go when CR (RETURN) is pressed. Can the PICAXE do this store > send? Even with external memory? I will also want to show received serial data from the D-Star radio as well as typed in characters from the keyboard on the LCD so both SERIN and SEROUT would need to be stored in memory, I could write SERIN (serial data from the radio) straight to the LCD I suppose but I would like to keep a history of messages in memory which can be stored and scrolled through.

I'm happy if someone here says this isn't possible with a PICAXE and points me towards some other complier that will do it. For those who understand it better it looks like this might do it http://www.piclist.com/techref/microchip/lcdrs232-al.htm but I'm not very experienced with PICs outside of PICAXE so don't know how to use or fuse the .ASM (assembly?) file.

Hope someone can point me in the right direction.

Thanks in advance,

Gavin.
 

hippy

Ex-Staff (retired)
It's possible but it can get complex. My first suggestion would be to split the project into two halves, keyboard to radio, radio to LCD and have a PICAXE for each. That simplifies everything.

Buffering for keyboard to radio should be easy enough. An 18X can store up to 112 characters in SFR (RAM) using PEEK and POKE and another 256 in Data Eeprom using READ and WRITE, over that you'll need external I2C RAM or Eeprom.

Radio to LCD should be fairly straight forward as well but not necessarily. It all depends on how quickly data arrives and how long it takes to process and put on the LCD. You may have to move up to an PICAXE-28X1 to do that.

While a split system is fairly straight forward, if you want to have what you're typing as you're typing shown on the LCD then a split system isn't very convenient for that. This is when it gets complicated because a single chip system is best but a PICAXE cannot be waiting for KEYIN and SERIN at the same time or doing anything else while doing either, so that means extra PICAXE buffering. Any PICAXE system which needs to handle multiple asynchronous inputs gets complicated, no matter how you slice it.

If you're prepared to put the effort into understanding the PICAXE and working through the complexities of the design you could get there, but I'd personally choose something else. If there's a solution already there that could be the best bet. No matter what you're doing it's going to have to involve some learning. I'd choose a Propeller Chip not least because it can drive a 40x13/40x16 NTSC/PAL TV display directly and handle quite a few asynchronous inputs at a time.

Or alternatively, use a PC or laptop and write code for that.
 

Gavinn

Member
Hi Hippy,

Thanks for the reply and the comments about what I might be able to manage. Using 2 chips is an interesting idea, something I din't think of before - it might just do it. However as you will agree it's a 'messy' solution compaired to a single chip but if KEYIN and SERIN are both needed I'm left requiring a larger (more able) PIC.

I had a quick look at the Propeller page but it's unclear if it's like PICAXE - i.e. free software download and custom bootcode chips or does it use a PIC programmer and cost money? I'll look at it more also...

Thanks again for your help and advice :)

Gavin.
 

hippy

Ex-Staff (retired)
Propeller is similar to a PICAXE, built in boot loader, free development software, different language and a more expensive download cable.
 

Gavinn

Member
Hi Hippy,

Thanks again for the info. Based on your recommendations using POKE, PEEK, WRITE and READ I've written some code I think will do the job!
View attachment PIC_TERMINAL_SERIAL.BAS

I've attached my code, which I'm sure can be optimized for anyone wishing to see how I've done it or copy it...

Gavin.
 
Top