Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Need help in interrupt VB6 hardware interface

Status
Not open for further replies.

kawin

Newbie level 4
Joined
Jan 22, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,326
Does anyone know how to

1. Click on command1 then the motor turns 180 degree back and forward continuously.
2. click on command2 then the motor spin clockwise continuously.
3. Click on command3 to stop.

Thank you in advance for every help.


Here is the code.

#include <16F877.h>
#fuses HS,NOWDT,NOPUT,NOPROTECT
#use delay (clock=20000000)
#use rs232(baud=9600,xmit=pin_c6,rcv=pin_c7)

int step [4]={0x01,0x02,0x04,0x08},i,x;
int steps[4]={0x08,0x04,0x02,0x01},j,y;
int8 send;
#INT_RDA
void RxD_ISR(void)
{
send=getc();
}

void motor_r(void)
{
for(i=0;i<4;i++)
{
output_d(step);
delay_ms(200);
}
}

void motor_l(void)
{
for(j=0;j<4;j++)
{
output_d(steps[j]);
delay_ms(200);
}
}

void main(void)
{
set_tris_d(0x00);
enable_interrupts(GLOBAL);
enable_interrupts(INT_RDA);
while(TRUE);
if(send==0)
{

..................................................................................code vb6...........................

Private Sub Form_Load()
MSComm1.Settings = "9600,N,8,1"
MSComm1.CommPort = 5
MSComm1.InputLen = 1
MSComm1.PortOpen = True
End Sub
Private Sub Command1_Click()
MSComm1.Output = Chr(&H0)
End Sub
Private Sub Command2_Click()
MSComm1.Output = Chr(&HFF)
End Sub
Private Sub Command3_Click()
MSComm1.Output = Chr(&HAA)
End Sub
..................................................

MODERATOR ACTION: Signature link removedMODERATOR ACTION: MODERATOR ACTION:
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top