【bascom】串口调试
用meag8,串口接收一个字符,然后转发回PC,以测试串口的自收自发无问题,从PC机发送字符到meag8之后,mcu收到的内容显示到lcd1602,基本都是255或者FF,返回到PC的基本都是00 80之类的或者ascii为类似E的乱字符why?
代码如下$regfile = "m8def.dat" ' specify the used micro
$crystal = 8000000 ' used crystal frequency
$baud = 19200 ' use baud rate
$hwstack = 32 ' default use 32 for the hardware stack
$swstack = 10 ' default use 10 for the SW stack
$framesize = 40 ' default use 40 for the frame space
Config Lcdpin = Pin , Db4 = Portc.2 , Db5 = Portc.3 , Db6 = Portc.4 , Db7 = Portc.5 , E = Portc.1 , Rs = Portc.0
Config Lcd = 16 * 2
Portc.0 = 1
Dim A As Byte , S As String * 2
Do
A = Inkey() 'get ascii value from serial port
If A > 0 Then 'we got something
Print "ASCII code " ; A ; " from serial"
Lcd A
End If
Loop Until A = 27 'until ESC is pressed
End 代码来之帮助文件,修改一些定义而已
页:
[1]