Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
November 24, 2024, 02:27:14 02:27


Login with username, password and session length


Pages: [1]
Print
Author Topic: Question: PICBasic Pro how to receive more than 2 byte of data from PC  (Read 4556 times)
0 Members and 1 Guest are viewing this topic.
rod27cn
Junior Member
**
 Warned
Offline Offline

Posts: 51

Thank You
-Given: 43
-Receive: 36


« on: May 11, 2008, 05:59:24 17:59 »

Hello, Can somebody help me on how to received more than 2 bytes of data from PC using PICBasic Pro. I am using PIC16F876A.

Please advise some idea or examples.

Thanks! Smiley

Posted on: May 11, 2008, 06:57:52 18:57 - Automerged

I am using RS232 communication by the way, I forgot to mention it.
Logged
strat
Newbie
*
Offline Offline

Posts: 12

Thank You
-Given: 11
-Receive: 0


« Reply #1 on: May 11, 2008, 08:19:09 20:19 »

You can use arrays. But the program worked on the PC must send data to Pic by byte variable.
Logged
maddoc
Newbie
*
Offline Offline

Posts: 32

Thank You
-Given: 49
-Receive: 14


« Reply #2 on: May 12, 2008, 08:47:22 08:47 »

I use a loop in the main program to receive nonstop data.

It usually can process around 19200bps of info with those CASE statements full of code.
I use to receive data also in the CASE statements, because some commands need 1 to 50 bytes of data.
Code:

MAIN:
C = HRSIN    
IF C <> $FF THEN

;do something if it is not a start command character ( $FF )

ELSE

CMND = HRSIN
SELECT CMND

CASE X
             do something
CASE X+1
             do something
CASE X+2
             do something
CASE X+3
             do something
CASE X+100
             for z = 1 to 50
             i[z] = HRSIN
             next
             do something with that array.

ENDSELECT
ENDIF
GOTO MAIN
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