Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Newbie - RS232 on a PICDEM2 Plus (with PIC16F877 chip)

3 views
Skip to first unread message

Malaclypse

unread,
Jul 22, 2004, 8:21:34 AM7/22/04
to
Hi there,


I'm pretty new to the PIC world, and I've been looking at using the
16F877. I got a PICDEM2 PLUS board
(http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010072&part=DM163022),
which seemed like a decent arrangement, with the likes of LCD display
and RS232 port already installed on the board.

The chip that is supplied is pre-programmed, but that doesn't matter,
and I have access to a MPLAB thingy for when I need to reprogram it.

I've got a copy of HI-TECH PIC-C HPDPIC c compiler, and a basic
background knowledge of C - but not extensive.
Found a few (conflicting) sites about the specific syntax for
controlling pins, but I'm not too worried about that, cause I can
experiment around until I figure out which instructions have it right!


My big problem is that I want to interpret commands from the RS232
port, and (on receiving specific commands), the PIC should react and
change its output.
I've been searching through the CD supplied with the board, and can't
really find anythign to do with the RS232 interface, except a fleeting
reference in the user's guide (also available online at address
above). This surprises me a little.
The sample files are written in assembler. I expect I can probably mix
and match, but I'd really rather have the C code for interpreting the
RS232.

So anyway, does anyone know an efficient way of parsing the RS232's
commands?

Any good sites/tutorials you can recommend?


I'd be grateful for any advice you can give!


Graeme

Gerry Cohn

unread,
Jul 31, 2004, 11:01:48 PM7/31/04
to

"Malaclypse" <gra...@kirkliston.co.uk> wrote in message
news:f2d3d5b7.04072...@posting.google.com...

/snip/


> The sample files are written in assembler. I expect I can probably mix
> and match, but I'd really rather have the C code for interpreting the
> RS232.
> So anyway, does anyone know an efficient way of parsing the RS232's
> commands?
>
> Any good sites/tutorials you can recommend?
>
>
> I'd be grateful for any advice you can give!
>
>
> Graeme

A lot depends on white type of command structure you are intending to use.
If you use simple single character commands followed by optional arguments,
then a simple switch
statement should do the job nicely.
I also recommend setting up the RS232 comms using circular buffers. Make the
receiver interrupt
driven and then in the foreground have a simple loop which retrieves
characters from the receive buffer
and pass these through to the parser.
Please let us know if this is what you are intending. I have plenty of code
snippets from projects that I
could pass on if the above structure fits your requirements.

HTH

Gerry


0 new messages