Posted: 24th Jun 2023 1:23
Hi All,

I've developed a rather simple Plugin that allows you to send raw bytes, or an array of bytes ( eg. a command packet ) down the serial port.

It's purpose is for low level protocol development, rather than sending strings as per SerialPlugin.

If it's of use to anyone I'm happy to share.
Posted: 24th Jun 2023 1:43
i know nothing about protocol development but assuming that THIS is the SerialPlugin you referenced?

meanwhile, as this is in Showcase, you should share or showcase something more than a description? ie, feel free to attach the dll (and i'll fit it into the first post HERE). i'm sure someone would appreciate it

btw, this one's different in that it can send bytes vs strings? again, i don't know anything about this stuff but trying to understand what differentiates this from the TGC plugin. if/when i do reference this in the directory, would "Byte-sized Serial Plugin" be a good description?
Posted: 24th Jun 2023 12:49
Hi VM,

It's different to SerialPlugin as this only sends strings.

eg. try sending the byte value 0x00 with SerialPlugin.. not a lot happens.

This plugin will allow you to send a packet of hex / decimal / byte values

So in essence, you could send [ 0, 0, 1, 253, 2 ] via the serial port..

And yes, I've posted in the wrong forum!

Too many late nights
Posted: 25th Jul 2023 13:43
Dear Ye

Could you please share your serial plugin to me? I confused ?string ? problem so much.

Thank you so much.

335600330gfk@gmail.com
Posted: 2nd Sep 2023 12:22
Hi!

Didn't get a notification of your response, happy to share my byte version
Posted: 23rd Sep 2023 14:37
Low Level Serial PlugIn

Hi All,

Here's a simple 'low-level' serial plugin for all to use, at present I've only compiled the DLL for Windows64.

It differs from SerialPlugin as it's sending RAW bytes not strings, so can be used for talking to Arduino's, Raspberry Pi's etc.

eg..

If you want to send a packet like an address poll..

[ destination address, nof bytes, host address, command, checksum ]

[ 0, 0, 1, 254, 2 ] ( decimal / hex )

Usage and Commands:

+ Code Snippet
#import_plugin LokiPlugin as loki_port

Basic COM handling..

get_nof_ports( max_ports as Integer )
open_com_port(  "COM8", 9600, TRUE or FALSE )
close_com_port( TRUE or FALSE to clear rx & tx buffers )

Buffer Handling..

clear_rx_buffer( )
clear_tx_buffer( )


get_rx_byte( offset into rx_buffer )
set_tx_byte( offset into tx_buffer )

/*-- Anything recieved? --*/

is_byte_available( )

reutrns nof bytes available as Integer

/*-- Read nof bytes from COM Port into Rx_Buffer --*/

read_nof_bytes_in( nof_bytes as Integer ) 

// return number of bytes written as Integer

read_byte( )

// return the byte value as a Integer

/*-- Write nof bytes from Tx_Buffer to COM Port --*/

write_nof_bytes_out( nof_bytes as Integer )

// return number of bytes written as Integer

write_byte( byte to send )

// return number of bytes written as Integer ( in this case 1 on success, 0 on fail )



Posted: 1st Oct 2023 1:10
Added to List of Community-Developed Plugins in Showcase
Posted: 22nd Dec 2023 3:46
Hi Yeshu777,
Do you have a version of the plugin for Raspberry Pi?
Posted: 23rd Dec 2023 16:49
Hi,

I'll take a look at it.

At present I use a simple c program I wrote, opens the COM port and acts as a go between AppGameKit and the system.

You can then call it via RunApp from AppGameKit, admittedly it was a quick fix solution, worked - so left it as is.

It'll send whatever you pass as variables.

This was to talk to an Arduino Nano / Mega whatever.. see the following :

+ Code Snippet
function nano_ResetBoard( )
	
	RunApp( "sudo", "./dtr.sh" )
	
	poll_app_count = 0
	kill_app_count = 0
	
endfunction

function nano_CheckIfConnected( )

	nano_present = FALSE

	// Remove Last Buffer
	if( GetFileExists( NANO_FILE_PATH ) > 0 )

		DeleteFile( NANO_FILE_PATH)
		
	endif

	RunApp( "loki", "?" )
	
	Sleep( 500 )
	
	if( GetFileExists( NANO_FILE_PATH ) > 0 )	

		buffer_file_ptr = OpenToRead( NANO_FILE_PATH )

		if( GetFileSize( buffer_file_ptr ) >= BUFFER_SIZE )
		
			last_buffer_mem = ReadString( buffer_file_ptr )
			
		endif
		
		CloseFile( buffer_file_ptr )
		
		DeleteFile( NANO_FILE_PATH )

		nano_present = TRUE
		
	endif

endfunction



Yeshu777