Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
December 09, 2016, 10:11:35 22:11


Login with username, password and session length


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

Posts: 139

Thank You
-Given: 66
-Receive: 117


falconbd.com


WWW
« on: September 24, 2008, 11:32:07 23: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 26, 2008, 12:08:41 00:08 »

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

Posts: 42

Thank You
-Given: 54
-Receive: 12


« Reply #2 on: September 26, 2008, 04:23:45 16: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: 57

Thank You
-Given: 28
-Receive: 17



« Reply #3 on: September 27, 2008, 12:18:40 12: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
V.I.P
Active Member
*****
Offline Offline

Posts: 139

Thank You
-Given: 66
-Receive: 117


falconbd.com


WWW
« Reply #4 on: September 27, 2008, 10:54:10 22: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, 09:45:09 21: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: 437

Thank You
-Given: 140
-Receive: 124



WWW
« Reply #6 on: September 29, 2008, 02:57:21 14: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, 03:02:06 15:02 by sohel » Logged

A Thousand Miles Journey Start With a Single Step<br />http://www.youtube.com/user/masud58
pici192
Guest
« Reply #7 on: January 30, 2009, 05:17:19 17: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, 05:58:54 05: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, 06:02:26 06: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