PDA

View Full Version : need help to set up a serial link



kinsiro
- 4th March 2006, 04:08
hi, i m doing my fyp title serial link communication, now i m using pic16f84 as my controller, i connect my pic to RS232(MAX232CPE-the chip i use), then connect it to computer. now i m using the command as following

__________________________________________________ ______________

Include "modedefs.bas" 'to enable the mode option for n9600

trisa = %00010
TRISB = %00000000

symbol sec = 1000

d0 var byte
s_out var porta.0 'set pin no as output pin
s_in var porta.1 'set pin no as input pin
led var portb.4

loop:
Serin s_in, n9600, 1000, no_data, ("x"), [d0]
serout s_out, n9600, [d0]

goto loop

no_data:
high led
pause sec
goto loop

end

__________________________________________________ ______________

how come i dun c the led light and i dun get any data from the pic...
p/s: how can i know whether my code is successfully sent? any idea to do tat?

Sphere
- 4th March 2006, 13:37
Try this.
--------------------------------------------------------------------------
Include "modedefs.bas" 'to enable the mode option for n9600

trisa = %00010
TRISB = %00000000

symbol sec = 1000

d0 var byte
s_out var porta.0 'set pin no as output pin
s_in var porta.1 'set pin no as input pin
led var portb.4

loop:
Serin s_in, T9600, 1000, no_data, ("x"), [d0]
serout s_out, T9600, [d0]

goto loop

no_data:
high led
pause sec
goto loop

end
--------------------------------------------------------------------------
Sphere

kinsiro
- 5th March 2006, 11:51
cannot oh.. the compile process is fail.. it stated error line-bad expression.. error line-expected '('
why will it like this?

Sphere
- 5th March 2006, 18:34
Tried compiling the program and got the same errors. What do you want the program to do and what commands are you sending to the pic.

Sphere.

Melanie
- 5th March 2006, 19:27
Ahem... people!!!!

The compiler is telling you what the problem is... let's all go back and read the MANUAL as to the correct SYNTAX for SERIN...

Not this...

Serin s_in, T9600, 1000, no_data, ("x"), [d0]

...but this...

Serin s_in, T9600, 1000, no_data, ["x"], d0

There's even an example in the book - read it!

Sphere
- 5th March 2006, 22:34
Hi Melanie still new to all this serial stuff myself, I just thought I would try to help some with the limited knowledge I have gained. By the way what part of the world are you from.

Sphere.

Melanie
- 5th March 2006, 22:38
I'm pretty cosmopolitan actually, but for the last few years London England (hub of the Universe) is my home.

Sphere
- 6th March 2006, 18:12
Thanks for the reply Melanie.From the UK myself. Maybe we meet accross a keyboard again.

Sphere.

kinsiro
- 7th March 2006, 17:47
Ahem... people!!!!

The compiler is telling you what the problem is... let's all go back and read the MANUAL as to the correct SYNTAX for SERIN...

Not this...

Serin s_in, T9600, 1000, no_data, ("x"), [d0]

...but this...

Serin s_in, T9600, 1000, no_data, ["x"], d0

There's even an example in the book - read it!

thx malenie.. and every1 i had done the rs232 part.. n comm is perfect