问题描述
公共共享adc_value as word_byte
公共类字节_low_hi
公共low_byte As Byte
Public high_byte As Byte
结束班
pmsg(2)= CChar(adc_value.word16.high_byte)
我收到以下错误high_byte不是整数的成员怎么
我能解决这个问题
Public Shared adc_value As word_byte
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
pmsg(2) = CChar(adc_value.word16.high_byte)
I get the following error "high_byte is not a member of Integer" How
can i fix this
推荐答案
- 显示引用的文字 -
- Show quoted text -
这些都是我的声明:
Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM
''全球联盟变量:
公共共享crc_value as word_byte''system crc value
公共共享adc_value as word_byte' 'adc值从
表中读取
公共共享location_value as word_byte''表地址
发送ADC值
公共共享pmsg As Byte()=新字节(24){}''crc缓冲区
公共共享tsize为整数
公共类byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
公共结构word_byte
Public word16 As Integer
公共byte8 as byte_low_hi
结束结构
''代码常量
''#Const BMS = True''这表示二进制
消息起始字节,值0x2A
''#Const PASSWD = True''这代表工厂
密码,值11548d
''#Const POLY = True''CRC中使用的多项式
算法
Public Const BMS As Char =" *" c
Public Const PASSWD As Integer =& H2D1C
Public Const POLY As Integer =& H8005
These are all my declarations:
Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM
'' Global Union Variables:
Public Shared crc_value As word_byte '' system crc value
Public Shared adc_value As word_byte '' adc value read from
table
Public Shared location_value As word_byte '' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} '' crc buffer
Public Shared tsize As Integer
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
Public Structure word_byte
Public word16 As Integer
Public byte8 As byte_low_hi
End Structure
''Code Constants
''#Const BMS = True '' this represents the binary
message start byte, value 0x2A
''#Const PASSWD = True '' this represents the factory
pass code, value 11548d
''#Const POLY = True '' the polynomial used in the CRC
algorithm
Public Const BMS As Char = "*"c
Public Const PASSWD As Integer = &H2D1C
Public Const POLY As Integer = &H8005
这些都是我的声明:
Public Class GlobalMembers
Public Array_AVG As ArrayList
公共com1作为MSCOMM
''全球联盟变量:
公共共享crc_value as word_byte''system crc value
公共共享adc_value因为word_byte''adc值从
表中读取
公共共享location_value as word_byte''表的地址
要发送ADC值
公共共享pmsg As Byte()=新字节(24){}''crc缓冲区
公共共享tsize为整数
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Cl屁股
公共结构word_byte
These are all my declarations:
Public Class GlobalMembers
Public Array_AVG As ArrayList
Public com1 As MSCOMM
'' Global Union Variables:
Public Shared crc_value As word_byte '' system crc value
Public Shared adc_value As word_byte '' adc value read from
table
Public Shared location_value As word_byte '' address of table
to send ADC value
Public Shared pmsg As Byte() = New Byte(24) {} '' crc buffer
Public Shared tsize As Integer
Public Class byte_low_hi
Public low_byte As Byte
Public high_byte As Byte
End Class
Public Structure word_byte
公共字16作为整数< - 整数类型
Public word16 As Integer <-- type of Integer
嗯,你去吧:
word16是一个整数(4个字节)而不是一个字节。您需要
将其转换为正确的类型。
Well, there you go:
word16 is an Integer (4 bytes) rather than just a byte. You need to
cast it to the correct type.
这篇关于字节不是Integer的成员的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!