Get the App
SLTechnology News&Howtos  ›  Development  › 

How to study IO Simulator under .net Micro Framework

Shulou Source: shulou.com Published: 2022-06-02 22:33:35 09月30日 Update

This article is about how to study the IO simulator under .net Micro Framework. The editor thinks it is very practical, so I share it with you. I hope you can get something after reading this article. Let's follow the editor to have a look.

Originally planned to use MF to develop a program similar to the Windows desktop (because it was found that MF actually supports progressive color, you can draw a very cool interface), as the current simulator supports only 5 keys, so it is difficult to do a Windows start menu with 4 arrow keys and an OK key, no one is suitable to do the start menu key. Remember that Digi's simulator supports at least nine keys, and since he can do it, so can I in theory. After a while of research, it really worked. I added two more keys to the five keys, one is the menu key (corresponding to the PC keyboard can be the Windows key or the space bar), and the other is the return key (corresponding to the ESC key on the PC keyboard), which means that the two keys on the simulator I used to do finally worked.

After adding these two keys, I suddenly had an idea. I couldn't do the IO simulation function before, and I should be able to do it. I didn't have the heart to do the Windows interface, so I focused on studying the IO simulator. Make some adjustments to the previous IO test program developed by Digi and you can try it (you need to reset Pin). The running interface is as follows:

PublicclassDigiTest

{

PublicstaticvoidMain ()

{

/ / Digi

/ / Cpu.Pin [] pin=newCpu.Pin [5] {(Cpu.Pin) 0, (Cpu.Pin) 1, (Cpu.Pin) 2

(Cpu.Pin) 5, (Cpu.Pin) 6}

OutputPort [] output=newOutputPort [8]

InputPort [] input=newInputPort [8]

/ / pin definition of Yefan Simulator GPIO

Cpu.Pin [] pin_I=newCpu.Pin [8] {(Cpu.Pin) 10, (Cpu.Pin) 11, (Cpu.Pin) 12

(Cpu.Pin) 13, (Cpu.Pin) 14, (Cpu.Pin) 15, (Cpu.Pin) 16, (Cpu.Pin) 17}

Cpu.Pin [] pin_Q=newCpu.Pin [8] {(Cpu.Pin) 20, (Cpu.Pin) 21, (Cpu.Pin) 22

(Cpu.Pin) 23, (Cpu.Pin) 24, (Cpu.Pin) 25, (Cpu.Pin) 26, (Cpu.Pin) 27}

For (inti=0;i7) intNum=0

}

}

}

After running, the effect is really good, if you change the input, there will be corresponding changes in the debugging information (through this, you can also deeply understand the meaning of pull-up and drop-down in new InputPort (pin_I [I], false, Port.ResistorMode.PullDown). At the same time, if you change the output in the program, the corresponding output lights will turn off synchronously.

Careful readers will find that my simulator allows instances of InputPort and OutputPort to run at the same time because their Pin values are different, while Digi's Icano shares 0, 1, 2, 5, 6 (God knows why? ).

In the future, when testing related IO applications, you don't have to connect the hardware, just use the simulator. I don't know whether the simulator supports serial port simulation (mapping PC physical serial port). We will have time to study it later. However, I think there must be something wrong with TCP/IP. First, the current TCP/IP of MF is not perfect, and the second simulator cannot support virtual network cards (similar to PPC simulators or virtual machines).

At present, the simulator supports 8-channel digital input and 8-channel digital output, and the analog quantity will have the opportunity to join in the future.

[note: at present, Microsoft's official simulator only supports LCD and 5 keystrokes, and none of the others.]

The above is how to carry out the research of IO simulator under .net Micro Framework. The editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.

Tags: Simulator support research two interface program menu run serial port function at the same time that is number more knowledge article keyboard development test output Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Microsoft Linux Xiaomi Redmi Apple