Basic Communications Program
Malcom Kemp
April 3, 2000
This program was written to facilitate the development of a communications program for the PIC
microcontroller. The overriding criteria were to be able to deliver precise 8-bit values to the PIC
over the RS-232 Tx line, and to receive and display precise 8-bit values from the PIC over the Rx
line. This program was developed from a program that Adam Davis made available through the
PICLIST (PIC microcontroller discussion list).
The USART on the PC can be explicitly controlled through the Settings menu selection. When
any of the Port, Speed, Data Bits, Parity, or Stop Bits selections are changed, the port is
disconnected, the change made, and then the port is reconnected, if it was open to start. There is
a small chance that data may be lost in this transition. It is expected that the port will be set to the
proper operating parameters before the port is connected.
The View menu selection will set the display of the output string and the response string to
either an escaped ASCII, or to a hex display. The hex display is a two character hex
representation of each byte separated by a space. The ASCII display displays printable
characters, but will escape non-printable characters with a \ character as follows:
\b backspace, hex byte 0x08
\t tab, hex byte 0x09
\n new line (line feed), hex byte 0x0A
\r return, hex byte 0x0D
\xHH any unprintable hex character 0xHH
\\ backslash character \
The output string can be edited at any time, just follow the rules of the display. For the hex
display, the hex characters must be space delimited. The field will be read, edited and rewritten
when you leave the field. Be sure what is written back is what you intended.
The send button will transmit the output string out the RS-232 transmit of the selected port.
The clear buttons can be used to clear the contents of the output string or the response string at
any time.
Although there is a limited space for display of the output string and the response string, they can
actually be very long. The cursor is left at the right end of the string, but you can use the home,
end and arrow keys to view portions of the string that may be hidden.
visual Basic 串口编写实例
需积分: 10 101 浏览量
2008-10-03
13:54:47
上传
评论
收藏 4.4MB RAR 举报
xuehui869
- 粉丝: 23
- 资源: 67
最新资源
- 3122080306 邹子轩 实验报告二.docx
- 基于STM32 NUCLEO板设计彩色LED照明灯(纯cubeMX开发)(大赛作品,文档完整,可直接运行)
- 发那科工业机器人保养大全
- Sphere.h
- REMD固有时间尺度分解信号分量可视化(Matlab完整源码和数据)
- 嵌入式系统双单片机STC89C52+STC15W104多功能学习板电路图可扩展 适用于单片机初学者和教学
- 基于STM32蓝牙控制小车系统设计(硬件+源代码+论文)大赛作品
- XILINXFPGA源码基于Spartan3火龙刀系列FPGA开发板VGA测试例程
- Java聊天室的设计与实现【尚学堂·百战程序员】
- python中matplotlib教程
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
评论0