MVCOM problems

Just starting out? Need help? Post your questions and find answers here.
ac667788
User
User
Posts: 10
Joined: Sun May 13, 2007 6:50 am

MVCOM problems

Post by ac667788 »

Can't transmit 0x00 across serial bus

MyBuffer1.s = Chr(2) + "L" + Chr(0) + Chr(0) + Chr(1)
If ComWrite(Hcom, @MyBuffer1, Len(MyBuffer1)+1)
Debug "Write Ok"
EndIf

No matter what I do, I can't Chr(0) to eb transmitted out of the serial port.
User avatar
DoubleDutch
Addict
Addict
Posts: 3220
Joined: Thu Aug 07, 2003 7:01 pm
Location: United Kingdom
Contact:

Post by DoubleDutch »

Have you tried poking into the string?

PokeB(@MyBuffer1+2,0)
PokeB(@MyBuffer1+3,0)

That may work?
ac667788
User
User
Posts: 10
Joined: Sun May 13, 2007 6:50 am

Post by ac667788 »

it's still acting funny, inconsistently sends out the 0 value
JCV
Enthusiast
Enthusiast
Posts: 580
Joined: Fri Jun 30, 2006 4:30 pm
Location: Philippines

Post by JCV »

Try. Im in cafe. :)

Code: Select all

buffer = AllocateMemory(5)
PokeB(buffer, 2)
PokeB(buffer+1, asc("L"))
PokeB(buffer+2, 0)
PokeB(buffer+3, 0)
PokeB(buffer+4, 1)
If ComWrite(Hcom, buffer, 5)
Debug "Write Ok"
EndIf  

[Registered PB User since 2006]
[PureBasic 6.20][SpiderBasic 2.2]
[RP4 x64][Win 11 x64][Ubuntu x64]
citystate
Enthusiast
Enthusiast
Posts: 638
Joined: Sun Feb 12, 2006 10:06 pm

Re: MVCOM problems

Post by citystate »

ac667788 wrote:MyBuffer1.s = Chr(2) + "L" + Chr(0) + Chr(0) + Chr(1)
PB terminates strings with Chr(0) - I think this could be your problem, try JCV's code
there is no sig, only zuul (and the following disclaimer)

WARNING: may be talking out of his hat
Post Reply