It is currently 22 Oct 2018 11:53

All times are UTC + 1 hour




Post new topic Reply to topic  [ 2 posts ] 
Author Message
PostPosted: 05 Jun 2017 16:17 
Offline

Joined: 20 Jan 2010 20:25
Posts: 14
Location: Faroe Islands
How can I set up an PIC16F887 for serial communication in Mikropascal? I need it to read 4800 baud, 8 data bits, no parity, and 1 stop bit. There is no handshake.
I need to read 2 devices, is there a way to set this PIC up for reading two, or do I need two Pic's, and have them to interact?
(There is nothing wrong with the device, as I can read it properly with a PC program)
I have tried to set it up for Uart and Soft Uart, and I get it to read bytes, but what i read makes no sense. It sends out a string of max 80 characters which I need to break down and handle afterwards.
Another (probably little) tricky thing is how I can get an ASCII code into a string. The Chr command requires a char type, and I cant find a way to convert char type into a string type.

Thanks for any help

Raymund


Top
 Profile  
 
PostPosted: 06 Jun 2017 02:31 
Offline

Joined: 18 Feb 2006 13:17
Posts: 4984
rayann wrote:
How can I set up an PIC16F887 for serial communication in Mikropascal? I need it to read 4800 baud, 8 data bits, no parity, and 1 stop bit. There is no handshake.
Simplest way would be to use the Help example on UART library. Searching the forum should give you some more elaborate examples.

Quote:
I need to read 2 devices, is there a way to set this PIC up for reading two, or do I need two Pic's, and have them to interact?
Better to use a processor with two hardware UARTs.

Quote:
I have tried to set it up for Uart and Soft Uart, and I get it to read bytes, but what i read makes no sense. It sends out a string of max 80 characters which I need to break down and handle afterwards.
I don't think it would work unless one used interrupts for both hardware and software UART (and not with mE's UART libraries).

Quote:
Another (probably little) tricky thing is how I can get an ASCII code into a string. The Chr command requires a char type, and I cant find a way to convert char type into a string type.
The chr function does nothing in mP (though I use it in code to have it formally correct :) ). One cannot convert a char to string, but one may assign a char to string thus forming one-char string, for example
var st: string[10];

st:='a';
Then one may add next char
st:=st+'b';
etc.

_________________
Replacement libraries for mP PRO and PIC18 processors, mP PRO tips & trics


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: