The Godfather talking
You can run, but you can't hide.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 28, 2024, 04:41:45 16:41


Login with username, password and session length


Pages: [1]
Print
Author Topic: rs-232 on pic16f876a  (Read 5028 times)
0 Members and 1 Guest are viewing this topic.
Pikoko
Guest
« on: May 26, 2008, 12:29:38 00:29 »

how would i program serial into that pic in picbasic pro. iv had someone tell me how to do it in proton plus but i dont have that.


all im wanting to do is recive a signal from the computer to turn on a light or more like 16 using a shift registry
« Last Edit: May 26, 2008, 12:48:38 00:48 by Pikoko » Logged
Wizpic
Global Moderator
Hero Member
*****
Offline Offline

Posts: 1195

Thank You
-Given: 538
-Receive: 408



« Reply #1 on: May 26, 2008, 11:10:53 11:10 »

This is quite easy to do, If you have got it in Proton then is shold be easy to port over to PBP

OR even better still i'm sure if read the manual it aslo give an example how to as well

I shall give you some tips how to eran some respect and a better way to get more help

1.Fisrt posting a question without any code or little info to back it up will not get you any where
2. do some research on what it is you want to do
3. have a go at writing your own code then post it here and explain what you can't do

This way you may get a better respone, don't get me wrong we want to help you and welcome new comers but you have give little infromation,

Well that's mt 2 cents worth, Others may view it differently to me

wizpic
Logged

When you think, "I can't do anymore. I need a break," that is the time to challenge yourself to keep going another five minutes. Those who persevere for even an extra five minutes will win in life..
Pikoko
Guest
« Reply #2 on: May 26, 2008, 09:29:03 21:29 »

okay well thanks for the tip and i had looked threw the manual and the examples in it didnt work .

i ended up getting it working.
Code:
INCLUDE "modedefs.bas"

'
' VARIABLES
'
Slate VAR byte ' Slate address
Cue  VAR Byte     ' Cue number

'
' SYMBOLS
'
Symbol RS232_out = 0 ' RB0 is RS232 output
Symbol RS232_in = 1 ' RB1 is RS232 input



TRISB = 2 ' RB0=output, RB1=input
PAUSE 2000

'
' Send Heading
'


Esample:
SERIN RS232_in, T9600, 5000, ESample, #slate
if slate = 255 then goto emode

EMode:
SERIN RS232_in, T9600, 5000, EMode, #cue
     if cue = 0 then emode
         If cue = 1 then cue_1
         if cue = 2 then cue_2
    goto Esample




cue_1:
high portb.7
pause 1000
low portb.7
goto emode

cue_2:
high portb.6
pause 1000
low portb.6
goto emode

now what im wanting to do is add the shiftout command.

iv tried
Code:
shiftout portb.7, portb.6, MSBFIRST, 1010\16
pulsout portb.5,1
_____________________________________________
EN = portb.5
EN = 0
shiftout portb.7 portb.6, 2,1010\16

EN = 1

im using a 4 Mhz crystal so would i need to define the OSC as being 4?
« Last Edit: May 26, 2008, 09:33:52 21:33 by Pikoko » Logged
sherm
Junior Member
**
Offline Offline

Posts: 44

Thank You
-Given: 14
-Receive: 9


« Reply #3 on: May 27, 2008, 06:20:41 06:20 »

Here are two good links to get you going. This is a good place to start for any comms based projects from PIC to PC using VB6 and PicBasic Pro.

http://www.rentron.com/sending_data.htm


http://www.rentron.com/receiving_data.htm
Logged
Pikoko
Guest
« Reply #4 on: May 27, 2008, 06:24:56 06:24 »

EDIT : NO NEED TO START NEW TOPIC FOR THE SAME THING MERGED TOPICS

with a 4MHz crystal can you use the shift out command

so far iv tried
Code:
shiftout portb.7, portb.6, MSBFIRST, 1010\16
pulsout portb.5,1
_____________________________________________
EN = portb.5
EN = 0
shiftout portb.7 portb.6, 2,1010\16

EN = 1
iv tried defineind the OSC as 4 and 20 and im now stumped and yes i looked threw the manual and did a search on the forums and couldnt find anything that would help.

the project i need this for is a addressable expandable firework firing system and im wanting to use 74hc595's or a6207ea-t which are both latching shift-registries. im using then to keep some i/o on the board free for other things
« Last Edit: May 27, 2008, 06:42:42 06:42 by Wizpic » 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