Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
April 18, 2024, 06:29:09 06:29


Login with username, password and session length


Pages: [1]
Print
Author Topic: serial port program  (Read 5523 times)
0 Members and 1 Guest are viewing this topic.
falcon _bd
Active Member
***
Offline Offline

Posts: 139

Thank You
-Given: 66
-Receive: 117


falconbd.com


WWW
« on: September 24, 2008, 10:32:07 22:32 »

 HELP ME !!!
I need some sample code in pic basic. I want to save my data  coming from serial port in pic MCU. Send me some sample code  using  inbuffer   and  out buffer. what is the maximum size of the buffer ??
Logged

microcom-ecuador
Guest
« Reply #1 on: September 25, 2008, 11:08:41 23:08 »

hello, you must to use serin and serout functions
Logged
babatundeawe
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 60
-Receive: 13


« Reply #2 on: September 26, 2008, 03:23:45 15:23 »

try and give some more details where.

like where are saving it to. the internal eeprom or external
what is the baud rate. where are u sending it from. try and expanciate more on this.
Logged
Silent_Thunder
Junior Member
**
Offline Offline

Posts: 69

Thank You
-Given: 56
-Receive: 20



« Reply #3 on: September 27, 2008, 11:18:40 11:18 »

Hi;
acually there is no hardware buffer for serial communication, it is only one byte, but still you can create your own sofware buffer and make as long as your free RAM permits.
Logged
falcon _bd
Active Member
***
Offline Offline

Posts: 139

Thank You
-Given: 66
-Receive: 117


falconbd.com


WWW
« Reply #4 on: September 27, 2008, 09:54:10 21:54 »

Code:
rs232t var PortA.5      'TXD to GSM-phone
rs232r var PortA.4      'RXD from GSM-phone
Baud  con 84             '9600,8,N,1 (true, driven)

SerOut2 rs232t,Baud,["AT",13]
SerIn2 rs232r,Baud,500,Conect_Error,[wait("OK")]
----------------------------------------------------

with this code I have to wait for ' OK '
when I get the ' OK ' program go to the next line.
But I need  to save the 'OK ' in ram.
AT + CMGR =1 , with this command i want to save the whole sms in my ram.
what should  i do for that.
I need the sample code.
Logged

hemlig
Translator
Active Member
***
Offline Offline

Posts: 168

Thank You
-Given: 26
-Receive: 50



« Reply #5 on: September 28, 2008, 08:45:09 20:45 »

@falcon _bd

have a look at: http://www.melabs.com/resources/samples.htm
try the examples and pick out and mix the code that fit your needs.

You need to do some experimenting of your own if you want to learn..

Among many things you have to decide where to store your string of characters.
Make variables, arrays, subroutines for collecting character by character to put in the array.

I see some beginning of such code and also that you thought about having a ram for storage.

That is good but it also involves a routine for handling writing and reading the ram usually via i2c etc.

Good luck with your experimenting.
Logged

If it work don't fix it!
sohel
Senior Member
****
Offline Offline

Posts: 442

Thank You
-Given: 167
-Receive: 149



« Reply #6 on: September 29, 2008, 01:57:21 13:57 »

from proton 16f didnt support string, but u may use
Dim SerString[12] As Byte     ' Create a 12-byte array. to store ur recived byte.
SerIn Rx, 84,[SKIP 10,Str SerString\11]        ' Fill the array with received data. skip 10 byte first and recived upto 11 byte.

Code:
rs232t var PortA.5      'TXD to GSM-phone
rs232r var PortA.4      'RXD from GSM-phone
Baud  con 84             '9600,8,N,1 (true, driven)

SerOut2 rs232t,Baud,["AT",13]
SerIn2 rs232r,Baud,500,Conect_Error,[wait("OK")]
----------------------------------------------------

with this code I have to wait for ' OK '
when I get the ' OK ' program go to the next line.
But I need  to save the 'OK ' in ram.
AT + CMGR =1 , with this command i want to save the whole sms in my ram.
what should  i do for that.
I need the sample code.

« Last Edit: September 29, 2008, 02:02:06 14:02 by sohel » Logged
pici192
Guest
« Reply #7 on: January 30, 2009, 04:17:19 16:17 »

Hi, you could find a lot of interesting project here too:

http://www.rentron.com/PicBasic1.htm
Logged
un2000
Newbie
*
Offline Offline

Posts: 8

Thank You
-Given: 0
-Receive: 1


« Reply #8 on: February 04, 2009, 04:58:54 04:58 »

is very easy.. look for samples INSIDE.. PROTON the example SER_BUFFER.BAS..... and shazamm...!!!   good look!! woking for interupt and drive the buffers..is ok
« Last Edit: February 04, 2009, 05:02:26 05:02 by un2000 » Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC