Bluestar88
Member level 3
- Joined
- Oct 17, 2014
- Messages
- 59
- Helped
- 0
- Reputation
- 0
- Reaction score
- 0
- Trophy points
- 6
- Activity points
- 447
Hi guys,
I have a problem with Using Visual basic interfacing with atmega32. My goal is sending a number which enters in Visual basic 6(VOL1 in Picture) and driving PORTB atmega32 by this number. for example if I enter 4 in VOL1, 0000 0100 (its binary) set in PORTB. I activated Usrat in codevision and its hardware (max 232 and DB9). RS232 works well because I could control some pins of atmega32 by code. ( for example I decribed a code of "q", If Check1.Value = 1 Then
MSComm1.Output = "q"
End If
but I dont know how I can do it for sending a number.....please help me...I want to send number via visual basic and putting it on port of atmega32...help me...
- - - Updated - - -
I converted my number to hex and then sent to micro controller by rs232.
my code in visual basic is here is here
in micro I received it by getchar()..my code is here( expressions such as "t", "q" , .... are for other orders)
But there is a problem yet....sometimes the number puts on PORT of micro is true (for 1,2 and 3) but the number of 4 does not put correct on the PORT...I do not know why.....please help me.....
I have a problem with Using Visual basic interfacing with atmega32. My goal is sending a number which enters in Visual basic 6(VOL1 in Picture) and driving PORTB atmega32 by this number. for example if I enter 4 in VOL1, 0000 0100 (its binary) set in PORTB. I activated Usrat in codevision and its hardware (max 232 and DB9). RS232 works well because I could control some pins of atmega32 by code. ( for example I decribed a code of "q", If Check1.Value = 1 Then
MSComm1.Output = "q"
End If
but I dont know how I can do it for sending a number.....please help me...I want to send number via visual basic and putting it on port of atmega32...help me...
- - - Updated - - -
I converted my number to hex and then sent to micro controller by rs232.
my code in visual basic is here is here
Code Basic4GL - [expand] 1 2 3 4 gg = Text1.Text tt = Hex(gg) MSComm1.Output = tt Text3.Text = tt
in micro I received it by getchar()..my code is here( expressions such as "t", "q" , .... are for other orders)
Code C - [expand] 1 2 3 4 5 6 7 8 9 10 { a=getchar(); if ( (a !='t')&&(a !='u')&&(a !='v') &&(a !='w')&&(a !='x')&&(a !='y')&&(a !='z')&& (a !='s')&&(a !='g')&&(a !='h') &&(a !='i')&& (a !='j')&&(a !='k')&&(a !='l') && (a !='m')&&(a !='n') &&(a !='f') &&(a !='b') &&(a !='c') &&(a !='d')&&(a !='e')&& (a !='q')) { PORTB=a; } }
But there is a problem yet....sometimes the number puts on PORT of micro is true (for 1,2 and 3) but the number of 4 does not put correct on the PORT...I do not know why.....please help me.....
Last edited: