Hexadecimal Serial command or queries

6 years 6 months ago - 6 years 6 months ago #29528906 by Herman
I have my controller connected via serial to a FPGA board. I use VHDL code to program the board. It is not very conveniënt to use decimal values in VHDL. Is it possible to use hexadecimal values as parameter ? I like to send the motor command (!G) with hexadecimal value and receive the encoder counter (?C) with a hexadecimal counter value. If possible, Please provide me with an example .

THKS, Herman

Please Log in or Create an account to join the conversation.

6 years 3 months ago - 6 years 3 months ago #29529260 by Herman
Example script which sent every ms the absolute encoder value in hexadecimal format (only positive values !!)
top:
dim rem[8] as integer
for i=0 andwhile i<8
rem[i] = 0
next

i = 0
print("\n")

pos = GetValue(_ABCNTR)

while pos > 0 
rem[i] = pos mod 16
pos = pos/16
i++
end while

for i=7 andwhile i>=0 evaluate i--

if 		rem[i]=10 then 
print("A")
elseif  rem[i]=11 then 
print("B")
elseif  rem[i]=12 then 
print("C")
elseif  rem[i]=13 then 
print("D")
elseif  rem[i]=14 then 
print("E")
elseif  rem[i]=15 then 
print("F")
else	
print(rem[i])
end if

next
wait(1)
goto top

Please Log in or Create an account to join the conversation.

Time to create page: 0.105 seconds