Running LED simulation on Microcontroller
Early game which is always done by people who are just learning the microcontroller is lit the LED. Although the first time we usually just turn on the LEDs moving to the right or left only, and usually things like that would be boring, but it is very important to understand how to program the microcontroller. Besides, if we want to develop programs that not only lit the LED which is lit only shifted to the right or left, then this game could get very interesting.
For example, the LED experiment using the table ie LED5.A51 in the Easy and Fun Learning microcontroller book, is a very interesting LED game. The picture above shows how the LED game if run on the simulator which is connected to VLED.
All you need to do to use VLED.exe when running simulations for LED5.A51 is connecting the P1 by Link Message with Message to be sent = WM_USER (1024), then fill Handle by Capture Handle to the running VLED.
Link setting is done by clicking the Option-Port menu of the simulator window. After that, the Port Settings window will appear. In this window, there are four tabs, the tab for Port 0 to Port 3. The contents of each tab are the same, that govern how the ports are connected. If you do not want to connect the ports anywhere, then choose None Link. Then Link Port is chosen if simulation port will be linked with the physical ports, such as parallel port or installed PPI port. Meanwhile, Link Message is used if the simulator is connected to another program via the Window Message. And the last is the Link File, that is if the port will be connected to a file.
If the Link Message selected, you must specify the Message to be sent, lParam to be sent, also Handle of the Window of the program receives the message. This parameter depends on the program that you want to link. For example, VLED received a WM_USER message, i.e. 1024. So the Message to be sent will also have to be 1024. While the lParam is not taken into account by VLED, so let it be what it is. And that should not be forgotten is to fill the Window Handle of the linked program.
To fill this Handle value can be done by clicking on the Capture Handle button, then click on the program that you want to link. Remember! After you click on the Capture Handle button should not click on anything other than the program that you want to link. Because the Capture Handle will fetch the handle of any clicked after this button is clicked. If the handle filling was done, then the Caption will usually appear the words as in the linked program. For example if the linked is VLED, then it would appear the words “Virtual LED”. After that, close the Port Setting window and enjoy the simulation.
You can also see how the LEDs run on the real LED by linking Port1 using the Link Port, then fill out the Address to 378, i.e. the address for the port. And you must install the LEDs on the parallel port as shown here:
To try the program, you can download the source code written either using assembly language and c language. And remember! You should discard the checkmark on the Option-Update Display menu in the simulator to make the simulator run faster. LED running speed may be not the same between your computer with the animation above. The speed of simulation depends on the speed of your computer.
Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.Please notice that comment or question submitted should match the topic.