C-10 จำลองออสซิลโลสโคป
การจำลองออสซิลโลสโคปด้วย VMLAB
โปรแกรม
#include <avr\io.h> // Most basic include files
#include <avr\signal.h> // here
#include <util/delay.h>
// ***********************************************************
// Main program
//
int main(void) {
DDRD = 0xff;
PORTD = 0xf0; //ส่งค่า F0H ออกที่พอร์ท D
while(1)
{ // Infinite loop; define here the
PORTD = ~PORTD; // ทำกลับค่า ที่พอร์m D
_delay_ms(10); // หน่วงเวลา 10 mS
}
}
คำสั่งที่เพิ่มเข้าในไฟล์โปรเจค
D1 VDD D1_NODE
R1 D1_NODE PD0 0.62K
D2 VDD D2_NODE
R2 D2_NODE PD7 0.62K
.PLOT V(PD0) V(PD7) ;สั่งให้พล็อตกราฟแรงดันที่ PD0 และ PD7
ผลการทำงาน
คลิกคำสั่ง View -> Scope และ View -> Control Panel