Com Port SPIN Problem
tibids
Posts: 3
HI!
Please help me, who is the problem?
[noparse][[/noparse]code]
...
pst.Start(9600) 'Set Parallax Serial Terminal
cog[noparse][[/noparse] 0 ] := cognew(Read(7), @stack[noparse][[/noparse]0])
cog[noparse][[/noparse] 1 ] := cognew(Button(7, 18, clkfreq/3), @stack[noparse][[/noparse]10])
PUB Button( pin1, pinb, rate)
dira[noparse][[/noparse]pin1]~~
outa[noparse][[/noparse]pin1]~
if ina[noparse][[/noparse]pinb] == 1
waitcnt(clkfreq / 4 + cnt)
!outa[noparse][[/noparse]pin1]
pst.Str(String("write test1"))
ina[noparse][[/noparse]pinb] := 0
return 0
else
ina[noparse][[/noparse]pinb] := 0
waitcnt(clkfreq / 20 + cnt)
return 0
PUB Read( pin ) | value
dira[noparse][[/noparse]pin]~~
outa[noparse][[/noparse]pin]~
value := pst.DecIn
if (value == 10)
repeat
pst.Str(String("write test2"))
return 0
elseif (value == 20)
repeat 10
pst.Str(String("write test3"))
! outa[noparse][[/noparse]pin]
waitcnt(clkfreq / 4 + cnt)
return 0
else
return 0
???
Please help me, who is the problem?
[noparse][[/noparse]code]
...
pst.Start(9600) 'Set Parallax Serial Terminal
cog[noparse][[/noparse] 0 ] := cognew(Read(7), @stack[noparse][[/noparse]0])
cog[noparse][[/noparse] 1 ] := cognew(Button(7, 18, clkfreq/3), @stack[noparse][[/noparse]10])
PUB Button( pin1, pinb, rate)
dira[noparse][[/noparse]pin1]~~
outa[noparse][[/noparse]pin1]~
if ina[noparse][[/noparse]pinb] == 1
waitcnt(clkfreq / 4 + cnt)
!outa[noparse][[/noparse]pin1]
pst.Str(String("write test1"))
ina[noparse][[/noparse]pinb] := 0
return 0
else
ina[noparse][[/noparse]pinb] := 0
waitcnt(clkfreq / 20 + cnt)
return 0
PUB Read( pin ) | value
dira[noparse][[/noparse]pin]~~
outa[noparse][[/noparse]pin]~
value := pst.DecIn
if (value == 10)
repeat
pst.Str(String("write test2"))
return 0
elseif (value == 20)
repeat 10
pst.Str(String("write test3"))
! outa[noparse][[/noparse]pin]
waitcnt(clkfreq / 4 + cnt)
return 0
else
return 0
???
Comments
You have only given us part of the code (which object is pst?). Use the archive function in the Prop tool and post the zipped file as an alternative to pasting, that way we are sure to get the whole code.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
*Peter*
The communication with PC is OK. I can sending and reading messages.
When I reading 1 button in PIN 7 AND I sending message to propeller at that time is problem.
How to can i reading 1 button in propeller (when is pushed, then i want sending message to PC) and sending back messages to propeller. (at a time)?
thanks
attach your code as shown in the attached picture
best regards
Stefan
The code, instead, it is important that you post it correctly since indentation says alot about the logic flow.
Are you sure
cog[noparse][[/noparse] 0 ] := cognew(Read(7), @stack[noparse][[/noparse]0])
cog[noparse][[/noparse] 1 ] := cognew(Button(7, 18, clkfreq/3), @stack[noparse][[/noparse]10])
both need pin 7 ? I understand that Button is on pin 7, while Read procedure is "doing" some input from pin 7 as well, like it was the serial in....am I correct?
Oh yes. Thank you for help!!!
Do not worry about your english. Sometimes we may have to ask for you to explain a different way, but the same applies to english anyway.
Make sure you archive you project using PropTool and post that (use the Post Reply section and not the Quick Reply section for attaching code).
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Links to other interesting threads:
· Home of the MultiBladeProps: TriBlade,·RamBlade,·SixBlade, website
· Single Board Computer:·3 Propeller ICs·and a·TriBladeProp board (ZiCog Z80 Emulator)
· Prop Tools under Development or Completed (Index)
· Emulators: CPUs Z80 etc; Micros Altair etc;· Terminals·VT100 etc; (Index) ZiCog (Z80) , MoCog (6809)·
· Prop OS: SphinxOS·, PropDos , PropCmd··· Search the Propeller forums·(uses advanced Google search)
My cruising website is: ·www.bluemagic.biz·· MultiBlade Props: www.cluso.bluemagic.biz