Check out this link
http://rentron.com/VisualBasic.htm
Frankly... you shouldn't consider VB6 in 2011. VB.NET (2005, 2008, 2010) is by far better.
Check out this link
http://rentron.com/VisualBasic.htm
Frankly... you shouldn't consider VB6 in 2011. VB.NET (2005, 2008, 2010) is by far better.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
i never use vb.net before..but if i use the software, is it possible to send command using zigbee (wireless) from PC to PIC..i've tried so many times using vb6 but the PIC seems like not receive the signal..the measured temperature can be displayed on the vb6 program but when i add the click button in vb6 to give command to PIC, my sensor doesn't do the measuring temperature..how to solve this problem?
OK no problem, VB6 is still workable and if you already know it, then let's try to find your problem.
What I suggest is to start small, I mean get rid of the ZigBee thing for now and just try to send some data from your PC to your PIC. Once you prove the hardware & software is OK, then add some pleasure to it.
Couple of things to check:
Is the Baudrate properly set on both side
Use a scope and see if there's any signal going from the PC to the PIC
debug further on that. Try the example on the previous link on RENTRON website.
We can have a look on your code, just paste it here.. PC and PIC side. Also tell us which PIC you're using and post your schematic. The more info info you give, the best.
Another cool thing to debug serial communication is called a Serial Port Sniffer. HHD soft one's my favourite.
http://www.hhdsoftware.com/serial-monitor
Pretty sure I've already posted something like that here... will try to find it.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
You should be all set with those
http://www.picbasic.co.uk/forum/showthread.php?t=5481
http://www.picbasic.co.uk/forum/showthread.php?t=1833
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Thank you mister_e..
I've set both baud rate=9600.
This is my PIC coding:
unsigned long temp_res;
unsigned long h;
void NumtoChar(char a)
{
unsigned char digit[3];
digit[0]=a/100;
digit[0]+=0x30;
a=a%100 ;
digit[1]=a/10;
digit[1]+=0x30;
digit[2]=a%10;
digit[2]+=0x30;
Soft_UART_Write(digit[0]);
Soft_UART_Write(digit[1]);
soft_UART_Write('.');
Soft_UART_Write(digit[2]);
}
void main()
{
Soft_UART_Init(PORTC, 7, 6, 9600, 0);
ADCON1 = 0x81;
TRISA = 0xFF;
TRISB = 0X00;
TRISC = 0X00;
TRISD = 0X00;
while(1)
{
temp_res = ADC_Read(0) >> 2 ;
delay_ms(300);
PORTB = temp_res ;
h = temp_res*1.3;
NumtoChar(h);
ADRESH = 0;
ADRESL = 0;
}
}
This is my VB coding:
Option Explicit
Dim ipt As String
Private Sub Command1_Click()
MSComm1.Output = "M"
End Sub
Private Sub Form_Unload(cancel As Integer)
If MsgBox("Are you sure you want to quit?", _
vbYesNo + vbQuestion, _
"Exit") = vbNo Then
cancel = 1
Else
End If
End Sub
Private Sub Form_Load()
MSComm1.CommPort = 3
MSComm1.PortOpen = True
End Sub
Private Sub Timer1_Timer()
ipt = MSComm1.Input
ipt = Right(ipt, 4)
Text1.Text = ipt
End Sub
The pic coding works and the temperature measured can be displayed on VB. But the VB coding above i add command button to send a character. I should add in the pic coding too right? I'm not good at coding. When i add receive coding in pic it doesn't works. The vb can receive temperature from pic, meaning they can communicate. Just the problem is the pic can't receive from vb. how to send the command from vb to pic?
Did you tried the last code example over there?
http://www.mikroe.com/esupport/index...soft_uart_read
However I would suggest
http://www.mikroe.com/esupport/index...barticleid=157
I would also suggest you to post on MikroElektronika forum, here it's for Melabs PicBasic Pro Compiler
The VB side should work.
Last edited by mister_e; - 13th June 2011 at 03:28.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks