Wilksey
|
|
Group: Forum Members
Posts: 14,
Visits: 18
|
It's not hard to pop a serial port with incorrect wiring.
However, dont forget when interfacing 232 with a uC especially the PIC series, you may need to use a driver IC to convert 232 levels (+/- 12v) to TTL (5v / 0v), I use the MAX232CPE chip, or the MAX481E for RS422/485, they have never let me down, and they have never damaged my serial port.
The MSCOMM Control is probably one of the very few controls that MS has managed to make decently, so as long as you close the port after use, it will not give you any problems.
The only time the MSCOMM control will make the port hang is if you use it within threads and dont close the threads, but a simple reboot of the machine will fix this.
Software will never break your hardware unless it's controlling something that applies voltage / current to the port.
I always over do it on the reisistors, capacitors and diodes in my circuits for the prototypes, just in case!
Regards
Wilksey
~Wilksey~
|
|
|
Wilksey
|
|
Group: Forum Members
Posts: 14,
Visits: 18
|
BTW, if you want USB comms via a uC, use the Microchip PIC18F series, available from Farnell etc quite reasonably priced for it's features, personally I use the 18F452 and the 18F4520
~Wilksey~
|
|
|
CDRIVE
|
|
Group: Forum Members
Posts: 548,
Visits: 2.6K
|
Wilksey (11/15/2008) BTW, if you want USB comms via a uC, use the Microchip PIC18F series, available from Farnell etc quite reasonably priced for it's features, personally I use the 18F452 and the 18F4520Welcome to the forum Wilskey. He is using a MAX232 interface. He mentions it Here
________________________________________________________________ "So much to learn. So little time to do it. Wise men know it's later than one thinks"! Mark's Syntax.Zip Pause Sub I don't answer programming questions via PMs. That's what the forum is for!
|
|
|
CDRIVE
|
|
Group: Forum Members
Posts: 548,
Visits: 2.6K
|
Wilksey (11/15/2008) BTW, if you want USB comms via a uC, use the Microchip PIC18F series, available from Farnell etc quite reasonably priced for it's features, personally I use the 18F452 and the 18F4520I'm glad you brought this subject up because I'm exclusively a MSComm guy. So what is the name of the VB USB control that will to talk to a USB microcontroller? Or is it a third party control?
________________________________________________________________ "So much to learn. So little time to do it. Wise men know it's later than one thinks"! Mark's Syntax.Zip Pause Sub I don't answer programming questions via PMs. That's what the forum is for!
|
|
|
Wilksey
|
|
Group: Forum Members
Posts: 14,
Visits: 18
|
I did use an active x once called HID Terminal or something similar in name.
[url=http://www.lvr.com/hidpage.htm][/url] Try this link for other HID related stuff.
Regards
~Wilksey~
|
|
|
Wilksey
|
|
Group: Forum Members
Posts: 14,
Visits: 18
|
Oops, I did the link wrong. HID Link
~Wilksey~
|
|
|
CDRIVE
|
|
Group: Forum Members
Posts: 548,
Visits: 2.6K
|
Wilksey (11/15/2008) I did use an active x once called HID Terminal or something similar in name.
Thanks for the link Wilksey. As compared to MSComm the code example in VB6 is intense though. The TS is a VB newbie and I think he would be better served becoming proficient with MSComm before attempting USB interfaced microcontrollers. As a side note.... I'm ticked off at Jan Alexson because I own Parallel Port Complete (but never really used it) and Serial Port Complete (first & second additions). When I received the second addition (8 years after I purchased the 1st) I was bummed out to find that Jan wrote the book for NET programmers! Before I spend any money on his USB Complete I want to be assured that it contains VB6 examples! It is my opinion that NET doesn't offer the programmer a significant advantage in programming power over VB6 to warrant the re-learning curve to use it, as would be by learning C++.
________________________________________________________________ "So much to learn. So little time to do it. Wise men know it's later than one thinks"! Mark's Syntax.Zip Pause Sub I don't answer programming questions via PMs. That's what the forum is for!
|
|
|
Wilksey
|
|
Group: Forum Members
Posts: 14,
Visits: 18
|
Yes, I am experienced in VB6, .NET(C# & VB) and c++, and dabbled in ASM, I agree with you that there is no real sense in learning .NET if you are happy with VB6, I still use VB6 for lots of things, I even use VB6 to create active X's to brighten up my C++ apps!
.NET is managed code and comes with a huge framework, but simple things that were doable in VB6 are no longer doable in .NET like control arrays for ex a simple thing, but very useful!
I use .net primarily to develop windows CE based apps for embedded devices.
99% of the USB stuff is API, so porting code shouldn't be a problem.
Serial stuff is great to learn, especially when delving into RS485 and uC's etc.
And I would fully agree with you when saying learn MSComm before USB, some things can become clearer if learnt in stages.
Regards
~Wilksey~
|
|
|
mvPradeepemb
|
|
Group: Forum Members
Posts: 46,
Visits: 85
|
Hi CDRIVE, WILKSEY, I am now using USB to Serial port converter, but i am receving the garbage value again.... My settings are as follows: Baud Rate : 9600,N,8,1 (ATmega16 and MSComm) Input Buffer Size :1024 Output Buffer Size : 512 Rthreshold =1 Sthreshold=0 Input Length=1 I also tryed using Hex to Decimal conversion, but i am receving only the garbage value... What changes should i do to receive the orginal value....
|
|
|
CDRIVE
|
|
Group: Forum Members
Posts: 548,
Visits: 2.6K
|
mvPradeepemb (11/18/2008) Hi CDRIVE, WILKSEY, I am now using USB to Serial port converter, but i am receving the garbage value again....OK, Lets make sure everything is working. The followingcode example uses a Looback tester. Don't blow anything up this time! The example reads the InBuffer data in the OnComm procedure. By the way, which model USB/Serial converter did you buy? I want to know this because we're going to test it to see if if recognizes the Break signal when you get everything working. EDIT: You can use the Form_Load & OnComm procedures by them selves with your controller. Option Explicit
Private Sub Command1_Click() Dim BytesToSend(7) As Byte ' Dimensioned to 8 Bytes Dim OutBuffer BytesToSend(0) = &H49 ' = Char 'I' & Decimal '73' BytesToSend(1) = &H23 ' = Char '#' & Decimal '35' BytesToSend(2) = &H4A ' = Char 'J' & Decimal '74' BytesToSend(3) = &H4B ' = Char 'K' & Decimal '75' BytesToSend(4) = &H4C ' = Char 'L' & Decimal '76' BytesToSend(5) = &H33 ' = Char '3' & Decimal '51' BytesToSend(6) = &H6A ' = Char 'j' & Decimal '106' BytesToSend(7) = &H1A ' = EOF Char: Decimal '26' ' Bytes are outputted in the order of there Index Number(Index)! ' MSComm1.PortOpen = True OutBuffer = BytesToSend() MSComm1.Output = OutBuffer Command1.Enabled = False Text1.Text = "" End Sub
Private Sub Form_Load() MSComm1.CommPort = 1 ' mscomm1.Settings = (Your Settings) MSComm1.RThreshold = 8 MSComm1.InputMode = comInputModeBinary MSComm1.PortOpen = True End Sub
Private Sub MSComm1_OnComm() If MSComm1.CommEvent = comEvReceive Then Dim InBuffer Dim DimensionedByteArray(7) As Byte ' Can handle up to 8 Bytes Dim intCount As Integer Dim intDecimal As Integer InBuffer = MSComm1.Input For intCount = 0 To (LenB(InBuffer) - 1) DimensionedByteArray(intCount) = CByte(InBuffer(intCount)) intDecimal = DimensionedByteArray(intCount) Text1.Text = Text1.Text & " " & intDecimal ' Display Decimal number Debug.Print intCount Next intCount Debug.Print TypeName(intDecimal) ' Confirm intDecimal data is Integer End If End Sub
________________________________________________________________ "So much to learn. So little time to do it. Wise men know it's later than one thinks"! Mark's Syntax.Zip Pause Sub I don't answer programming questions via PMs. That's what the forum is for!
|
|
|