一,打开文件(可以随文下载放置在文档中打开)。(如下图1所示)
Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图1

二,调整原理图大小,适合可视,另存工程文件。(如下图2,3,4所示)
Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图2

Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图3

Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图4

三,点击Source Code标签。(如下图5所示)
Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图5

四,编辑main.py Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light (如下图6所示)

五,Main.py 代码:

!/usr/bin/env python3

Generated by Proteus Visual Designer for Raspberry Pi

Modules

from goto import with_goto
from stddef import *
import var
import pio
import resource
from datetime import datetime

Peripheral Configuration Code (Do Not Edit)

#—CONFIG_BEGIN—
import cpu
import FileStore
import VFP
import Ports
import Generic
import Controls

def peripheral_setup () :

Peripheral Constructors

pio.cpu=cpu.CPU ()
pio.storage=FileStore.FileStore ()
pio.server=VFP.VfpServer ()
pio.uart=Ports.UART ()
pio.LED1=Generic.LED (pio.GPIO20)
pio.IotBtn1=Controls.PushButton (“IotBtn1”, )
pio.IotLED1=Controls.Indicator (“IotLED1”, )
pio.IotBtn2=Controls.PushButton (“IotBtn2”, )
pio.storage.begin ()
pio.server.begin (0)

Install interrupt handlers

pio.IotBtn1.attachEventHandler(chart_OnIotBtn1)
pio.IotBtn2.attachEventHandler(chart_OnIotBtn2)

def peripheral_loop () :
pass

#—CONFIG_END—
def variables_setup () :

Flowchart Variables

pass

Flowchart Routines

@with_goto
def chart_SETUP () :
pio.uart.setup (9600)
pio.uart.println (“Remote Light: \r\n”)
return

@with_goto
def chart_LOOP () :
return

@with_goto
def chart_OnIotBtn1 () :
pio.IotLED1.setState (True)
pio.IotBtn1.setLamp (True)
pio.LED1.on ()
pio.uart.println (“Light on.”)
return

@with_goto
def chart_OnIotBtn2 () :
pio.IotBtn1.setLamp (False)
pio.IotBtn2.setLamp (False)
pio.IotLED1.setState (False)
pio.uart.println (“Light off.”)
return

Main function

def main () :

Setup

variables_setup ()
peripheral_setup ()
chart_SETUP ()

Infinite loop

while True :
peripheral_loop ()
chart_LOOP ()

Command line execution

if name == ‘main’ :
main()

六,点击构建工程按钮,编译工程。(如下图6所示)
Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图6

七,点击窗口左下方仿真按钮,可见虚拟LED Light显示。 (如下图7,8,9所示)
Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图7

Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图8
Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图9

八,选择release,点击构建工程按钮,编译工程生成Hex文件。(如下图10所示)

Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light

图10

附件下载:https://download.csdn.net/download/kaillen/12937808
附件Proteus8.10 VSM Studio python编译器仿真Raspberry_系列_48_Remote_Light在已安装Proteus8.10的计算机文件夹中打开即可
需要进一步了解,请加入QQ群:976235464

相关文章:

  • 2021-05-04
  • 2022-01-12
  • 2021-10-24
  • 2021-06-12
  • 2021-08-14
  • 2021-04-17
  • 2021-06-08
  • 2021-09-16
猜你喜欢
  • 2021-04-15
  • 2021-08-20
  • 2021-09-03
  • 2021-08-16
  • 2021-09-21
  • 2022-01-17
  • 2021-09-18
相关资源
相似解决方案