Master_Zaehler

Windows® Compatible Software for Displaying LIN Messages
Post Reply
otahh
Posts: 1
Joined: Sun 2. Dec 2018, 17:22

Master_Zaehler

Post by otahh » Sun 2. Dec 2018, 17:28

Hallo,
I am trying to figure out, how to simulate "Master_Zaehler" field in LIN frame. It means a value that goes from 0 to 15 and is incremeted after sending each message.
Is this possibility in PLIN-View Pro?
I am trying to use the schedule table and define the frame 16 times, but still could not figure out the way how to define the frame content in schedule table...

Thanks in advance for the help!
Ota

M.Riedl
Software Development
Software Development
Posts: 34
Joined: Wed 22. Sep 2010, 13:28

Re: Master_Zaehler

Post by M.Riedl » Mon 3. Dec 2018, 12:02

Hello,

With a VB script you can control some functions of the PLIN-View Pro.
With that you can manage rolling counting yourself.

Here is a simple example to send a rolling counter:

Code: Select all

' Enumeration PLIN Mardware Mode
const plinHardwareModeNone = 0
const plinHardwareModeSlave = 1
const plinHardwareModeMaster = 2

' Enumeration PLIN Direction
const plinDirectionDisabled = 0
const plinDirectionPublisher = 1
const plinDirectionSubscriber = 2
const plinDirectionSubscriberAutoLength = 3

' Enumeration PLIN Checksum Type
const plinChecksumTypeClassic = 1
const plinChecksumTypeEnhanced = 2
const plinChecksumTypeAutomatic = 3

Dim appObj
Set appObj = CreateObject("Peak.Lin.ViewPro.COM.Interfaces.Application")
If Not appObj Is Nothing Then
	WScript.Sleep 100
	' Connect to a LIN hardware
	' =============================================
	' 1. Parameter: Device
	' 2. Parameter: Channel
	' 3. Parameter: Mode
	' 4. Parameter: Bit rate
	If appObj.ConnectTo(1, 1, plinHardwareModeMaster, 19200) Then
		For i = 0 To 15 Step 1
			' Publish Frame Data
			' =============================
			' 1. Parameter: ID
			' 2. Parameter: Length
			' 3. Parameter: Checksum Type
			' 4. Parameter: Data
			If Not appObj.PublishData(0, 8, plinChecksumTypeEnhanced, Array(i And &hFF, &h00, &h00, &h00, &h00, &h00, &h00, &h00)) Then
				MsgBox "Error on publish Frame with ID 0"
			End If
			appObj.Wait 50
		Next
	Else
		MsgBox "LIN is NOT connected"
	End If

	If MsgBox ("Close Application?", vbYesNo, "Rolling Counter Script") = vbYes	Then
		appObj.Close false
	End If
	Set appObj = Nothing
End If
More information about VB script support you can find it in the online help of the PLIN-View Pro.
PLinViewProVBScriptHelp.JPG
PLinViewProVBScriptHelp.JPG (94.5 KiB) Viewed 7557 times
Regards
M.Riedl

Post Reply