Home
JAQForum Ver 24.01
Log In or Join  
Active Topics
Local Time 09:22 26 Nov 2024 Privacy Policy
Jump to

Notice. New forum software under development. It's going to miss a few functions and look a bit ugly for a while, but I'm working on it full time now as the old forum was too unstable. Couple days, all good. If you notice any issues, please contact me.

Forum Index : Microcontroller and PC projects : Have you come across this serial protocol

Author Message
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 01:54pm 28 Sep 2012
Copy link to clipboard 
Print this post

Hi Guys

I've got some equipment that talks between modules using standard 19200 serial.
I want to mimic some of the data using the maximise display.

Is the protocol below a standard one and is there standard code formation for working with it?
I'm just learning to write code in Basic and never been very good at writing code!
------------------------------------------------------------ -------------------

Commands are always sent as 1 serial word with bit 7 set.

All Data bytes are sent as 2 serial words. The first word is the 7 lsbs of the data byte (bit 7 clear) The second word will contain the msb of the data byte in bit 0 (all other bits clear)

Thanks for the help.
Steve Izett



 
VK2MCT
Senior Member

Joined: 30/03/2012
Location: Australia
Posts: 120
Posted: 08:54pm 28 Sep 2012
Copy link to clipboard 
Print this post

Could this be an old octal orientated protocol ?
Six bits in the first word (two octal bytes) being DEC Sixbit ASCII.
The second word being one bit of parity ????

John B
VK2MCT
 
boss

Senior Member

Joined: 19/08/2011
Location: Canada
Posts: 268
Posted: 07:39am 29 Sep 2012
Copy link to clipboard 
Print this post

Hi Steve,

this protocol is a little strange, but why not? I assume that the data is a binary 8 bit long code, bits 0-6 are sent in the first byte, and bit 7 is bit 0 in the second byte. It is a weird configuration but easy to read and use. Is there any way I can help you with it?


Regards
boss
 
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 11:33pm 29 Sep 2012
Copy link to clipboard 
Print this post

Thanks John
Thanks Boss

Thanks for the offer.
How about the following code!
How do I set a Flag and invert it like the ! operator in C.

DO WHILE INPUT$(1,#1) <> &hF0 :LOOP 'Command is 8th bit set
MSB = TRUE 'Data is going to come down the pipe MSB followed by LSB
FOR i = 0 To MAX
arg(i) = &h00 'Clear table data ready for new data
DO
x$ = INPUT$(1,#1)
IF MSB THEN 'If its the MSB then store the data word in the Table
arg(i) = x$
ELSE IF NOT(MSB) AND x$ = &h01 THEN 'if its NOT the MSB AND its got its bit0 set then add 80h
arg(i) = arg(i) + &h80
NOT(MSB) 'Reset MSB flag
LOOP
NEXT i
LOOP

Cheers

Steve
 
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 03:22am 30 Sep 2012
Copy link to clipboard 
Print this post

Hi Boss

I did a little more work on the code. See below:
I think I have a problem with data types. Should I be working with a string or does it need converting
to work with raw numbers.


Cls 'Clear the screen
Open "Com1:19200" As #1 'Open a 19200 baud Serial Port
Dim arg$(32) 'Set up a table for the data

Do 'Main Loop
If Loc(#1) <> 0 And Asc(Input$(1,#1)) <> &hF0 Then 'If Data is present
MSB = 1
For i = 0 To 31
arg$(i) = ""
Do
x$ = Input$(1,#1)
If x$ = "255" Then
Exit Sub 'End of data so return
EndIf
If MSB = 1 Then
arg$(i) = x$
Else IF MSB = 0 And x$ = "1" Then
arg$(i) = arg(i) + &h80
EndIf
If MSB = 1 Then
MSB = 0
Else MSB = 1
EndIf
Loop
Next i
EndIf
Loop


 
JohnS
Guru

Joined: 18/11/2011
Location: United Kingdom
Posts: 3801
Posted: 04:05am 30 Sep 2012
Copy link to clipboard 
Print this post

The equivalent of C's ! is just:
x = 1 - x

(so long as x is already the equivalent of C's true or false)

John
 
steveizett
Newbie

Joined: 15/05/2012
Location: Australia
Posts: 21
Posted: 12:41pm 30 Sep 2012
Copy link to clipboard 
Print this post

Thanks John
Appreciate it.

Steve
 
Print this page


To reply to this topic, you need to log in.

© JAQ Software 2024