Hi,
I have to communicate with PC via USB, I use PIC18F2550 I wanted to do a practical thing without the classic USB-SERIAL converter, there is a suitable library I think is very useful on several occasions.
I found a library with the JAL compiler ver.2 but it does not work well, the device is seen correctly by WIN but I can not communicate any data.
Gigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
No, you are already doing a huge job to keep GCB up to date, I wanted to find the possibility to transfer data from PIC to PC, having found nothing I looked around.
Unfortunately there is nothing that works, certainly it is very complex to create a library also because usb must constantly communicate with other devices.
Thank you,
Gigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We have just released the first phase of USB support. See the C:\GCB@Syn\GreatCowBasic\Demos\usb_solutions\greatcowbasic_solutions\libwinusb_solutions directory
Whilst not tested explicitly with your part - it will work.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C:\GCB@Syn\GreatCowBasic\Demos\usb_solutions\greatcowbasic_solutions\libwinusb_solutions directory is not in my demos.
Please post a link to the latest demos...and help files. I loose track of where files are stored. Thanks.
Last edit: stan cartwright 2018-12-14
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Yes, I've already seen this solution, interesting but it requires a dedicated program with relative DLL to manage communication, and if it is seen as a serial, it can be used with various programs. I have read several previous posts on the subject and I think there are problems with the recognition or rights of serial drivers or something like that, I did not understand well and unfortunately I do not know.
Gigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
In your first post you say 'without the classic USB-SERIAL converter' so, the USB demo and the related application meets that criteria.
Then you post 'g but it requires a dedicated program with relative DLL to manage communication, and if it is seen as a serial,'... It is NOT serial it is LIBK which you seem to understand in your reference to the DLL. There are no know issues with the 'recognition or rights of serial drivers' - did you try the demo?
I am asking as an advisor, so, please excuse my straight language, if English is not your first language. Do not be offended.
If you do not want to use USB-SERIAL converter and the LIBK solution is not OK - then, I think you are asking for the USB-CDC library for Great Cow BASIC? With this USB-CDC library is will be exposed to the PC as a serial port but without the 'classic USB-SERIAL converter' - Is this what you want?
Once we get the ask sorted - I can advise further.
Anobium
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Where is latest version with usb demos?
I downloaded the demos on github twice and unzipped with win7 extract all...gcb-demo-source-master and 7zip and both gave errors, file path to long was win7 extract all. 7zip was just error numbers.
The demos seem intact. downloaded twice.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I wasn't complaining. The demos download gave errors unzipping. Try.
I usually install new gcb updates on 2 laptops and a desktop pc when they're anounced on the forum. This laptop has gcb 98.03 in uninstall programs but the version in use is 98.02 ??
There's 90.01, 98.02, 98.02 rc05 and 98.03 in uninstall programs list.. but clicking on and uninstall says they're uninstalled. Normally the item is removed from the list when it's uninstalled.
The other 2 pcs are on 98.03. and have usb support demo.
I found libk from a search for free win usb driver.
I have some pics with usb to try but usb is new to me. I will try sending adc to the gcb terminal. The sort of thing that's easy with arduino boards and probably a 18f46k42 evaluation board.
My problem would be if I wanted to program my own windows interface. The only option for me would be free basic which seems to support libk and is all I can think of that's free and I can use. I did use free delphi once, probaly obsolete now.
github is a git to use.
edit- just downloaded latest gcb for this laptop. The uninstall previous isn't working so just erased. When new version installed pickit 2 and 3 plus are gone. Copied from other pc to usb stick then pasted to new version and after changing icons it's working again...phew.
It must be irritating having to put up with beginners. Sorry but that's what you get when you make something like pic programming simple for not expert people like me.
I like windows pretty pictures and mouse. I remember dos :)
...please don't suggest I try blocky gcb
I would never complain about gcb. Is there any other free pic/avr basic that's as useful as gcb? answers on a postcard to...
Last edit: stan cartwright 2018-12-15
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I have programmed usb_ibkwinusb_16f1454 to chip ok. Awaiting 3 usb type 2 break out boards...the big ones like pickit 2 socket and printers. see then.
I found pickit3 programmer and pickit3plus programmed this chip ok. lvp l8r , this works. see photo 5 wires...works to.
I dunno when to use pickit3 or 2 hardware. Dunno if the 16f1454 can be programmed without pickit plus. northern software flashes a gcb hex file to this chip ok. pics are so mystical.
Until I mount the chip/socket etc I installed the 86 driver so what next?
what's the dll for?
what day is it?
edit- isn't pickit plus easy, 5 wires from ebay pickit3 to spare breadboard...even I can do this..and it worked first time. and there's irrellevent leds to confound you.
In ~2004 Microchip released the PICKit1 programmer. It was a development board and could program the , at that time, NEW flash based 8 and 14 pin Devices, and Microchip provided all of the Schematics and software for people to be able to use it as a reference design and build their own versions.
In ~2007 Microchip Released the PICKit2 as a Standalone ICSP (In Circuit Serial Programmer) with a separate Development board (Low Pin Count Board) that could accommodate any current 8, 14 or 20 Pin Microcontroller.
The great thing about PICKit2 was that it was a community effort and designed in collaboration with the users. As a result it was open source and open hardware.
PICKit2 was a raging success, with the community adding software features and Microchip adding device support. (If you haven’t yet done so try using a PICKit as a logic analyzer the hardware price is worth it for that community added feature alone).
In 2009 microchip did an about face and decided that Development tools should be a Profit Center and that Programmers should be proprietary software and closed hardware.
They released the PICKit 3 and it was a disaster. The Community rebelled against it and rather than listen to the community, and provide the required features, Microchip went the opposite way. To force People to purchase the NEW PICKit3 they stopped updating the PICKit2 and created a new version of the populer LPC Board. As a result Newer devices, most notably the PIC32 parts, required PICKit3 and MPLAB IPE in order to be programmed and all of the PICKit Lessons that use the LPC Board were changed to use a Proprietary C Compiler.
Under pressure Microchip finally released the PICKit3 version of the PICKit2 GUI but, rather than add features, it turns the PICKit3 into an inferior Clone of the PICKit2 and only supports a subset of the PICKit2 devices. It also loses the ability to program any of the newer devices.
The PICKit2 community ignored the PIC32 devices but continued to update the 8 bit parts database, despite microchip withdrawing support, until Microchip changed the Programing Protocols inside the newer 8 bit devices to make PICKit2 completely obsolete.
Roll on 2018 and Microchip have still not learnt their Lesson. They release the even more proprietary, and slower, PICKit4 programer that now needs all 5GB of MPLabX to be installed just to flash an 8 pin chip.
A Call to Arms
Our Hero, Anobium, along with the PICKit fans as a whole decided that this was enough.
With Anobium leading the charge they Reverse engineered the workings of all of the PICKit Models, and all of the New Programming Protocols that Microchip had introduced in their effort to obsolete each predecessor version version of PICKit.
They came up with the PICKit+ Software that can use any PICkit Device you may own to, Program any Microchip Device that is supported by Great Cow BASIC.
And I might add a good many that are not supported by GCBASIC, including PIC32.
PICKit+ directly addresses all of the problems, and confusion, caused by Microchips mangled marketing of support products and gives Students, Hobbyists and anyone needing a fast prototype, access to a Lightweight IDE, Fast and easy to learn Compiler and the convenience of Using any of the Millions of PICKit2 programmers and Clones that are sitting in people's Junk Boxes and orphaned by Microchip.
Whilst Microchip were not initially happy about PICKit+, hence it having to be a seperate project and donation based, so that it avoids licensing issues and allows Microchip to continue Supporting GCBASIC as an open source project, they are begging to see the need for an easy to use accessible Hobby/student programing tool.
Conclusion
What you have experienced Stan, and many others like you, is a practical example of the above.
Confusion , Acceptance, and then Enlightenment.
When you saw the power of PICKit+, all of the confusion fell away and the Original Concept of 5 wire ICSP was once again both obvious and enjoyable.
Cheers
Chris
Last edit: Chris Roper 2018-12-16
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
And, to add. PICKit+ will shortly be fully integrated into MPLAB-X IDE. Guess who wants to integrate it...... Microchip. So, you will be able to use MPLAB-X to program any microcontroller via a PK2 or a PK3 - I am not saying you can get the PK2 or a PK3 debugger running from witnin MPLAB-X but to program via a PK2 or a PK3 is a step in the right direction.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That is good news and another feather in your cap.
Even If you dont think you are a hero the powers that be have seen the futility of opposing you and are willing now to embrase PICKit again.
That is a move that no one has forseen.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Anobium
Maybe we do not understand each other well, it's also my fault that I do not know the problem well and also of communication with automatic translator.
I do not know LIBK, can you give me some other information?
Yes, I meant USB-CDC library for Great Cow BASIC
Anyway I want to try the LIBK library provided with GCB well before making further comments, I hope that goes well.
Thank you
Gigi
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
LIBk: We have provided in the demonstration the project to enable the exposure of the LIBk methods. I included communications and recovery in the windows project, and, in the Great Cow BASIC project how to send and receive.
The big benefit of LIBk over CDC is the recovery. LIBk can recover from disconnects and insertion. CDC, unless the serial program is very very very clever will loose communications upon a disconnect, and, communinication can start until the CDC (virutal com port) is active. This is why we started with a robust library based on LIBk.
Good Luck.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
@Stan. Unless you know what the goal of your USB project is... you will be sorely disappointed. The demonstration shows how to use LIBk to create working Windows EXE (also provided) to read and set the ADCs and LEDs respectively within the attached microcontroller.
So, if you want to see the demo work - where the EXE talks the microcontroler then this should work and you will learn that USB between a PC and microcontroller using Great Cow BASIC works.
If you want then venture into the Windows EXE project you will learn how to adapt the communications via the USB to add more capabilites such as remote control (via the USB) of PWM, more LEDs etc etc. You will need to use Microsoft Visual Studio or SharpDevelop for this.
Enjoy
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks Chris for the unbiased potted history. It's was new to me.
I've never used c++ but tried asm using parallel printer port programmer..from ETI magazine and I think Icprog worked.
I used a pc serial lead to program picaxe and nothing else.
Usb is something I take for granted - plug n play but it will be interesting.
My 3d printer uses an arduino 8 bit controller and can be controlled with usb and win program.
It's quite impressive. https://www.youtube.com/watch?v=CDlj0jBtYmQ
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
I searched freebasic usb and found a link to libk on source forge but also post about using freebasic with arduino.
I connected a uno, it was on com7 and tried this fb program but no send back program on the arduino. It ran without error.
If I sent an "a" the arduino could check and turn a port on, a "b" another port.
This seems too easy. What's needed for a pic with usb to do the same?
dimxasstring,secsassingle,taslongopencom"COM7:9600,N,8,1,ds0"as2'open com ("COM2:9600,N,8,1,cs0,ds0,cd0,rs" as #2)'Waitforacoupleofsecondssecs=2t=timer:whiletimer<t+secs:wend'Inputacharacter,sendittotheSketchandreceiveitbackinput"Type any character: ",xprint#2,x;:print"Sent a: ";xinput#2,x:print"Got: ";xwhileinkey$="":wendclose
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
That code would work with any PIC, or any other device with a USART.
Nothing in that code is USB and, whilst you have not shown your Arduino Code I would hazard a guess that nothing in that code relates to USB either.
Do not confuse an Arduino Board with a PIC chip.
An Arduino is an ecosystem with an AVR ATMega Device connected to a USB/Serial Bridge in an external package.
The Comparable PIC board would be the Curiosity or the XPress Evaluation board.
Try your code on one of those and it will work just as well as on the arduino.
Or just attach an external USB/Serial Bridge to any PIC for the same results.
USB is a totally Different animal and most USB Protocol Stacks actually consume more Memory than Most 8 Bit Microcontrollers have available. Hence USB devices normally being dedicated to USB/Serial conversion. Keyboard Scanning or Mouse Movement.
It is the Realm of the 32 and 64 bit devices from Qualicom and Cortex where you have sufficient resources for USB to be just another peripheral. USB was designed for PC’s not Microcontrollers and the Microcontrollers that are released with USB are intended to create simple peripherals to PC’s not to use USB as a USART replacement.
So in conclusion, the above can be done on any PIC, but if the above were done on any USB device, PIC or other brand 8 Bit device, you would have little or no memory left to do anything other than toggle the pins under PC control.
Cheers
Chris
Last edit: Chris Roper 2018-12-17
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Thanks. I thought pic usb would be limited to what can be done with usb-ttl adaptor.
I didn't find much searching for pic-usb-windows-freebasic.
If you see a mega2560 running a 3d printer from usb it's impressive, controlling bed and nozzle temp and 4 steppers with precision and a lcd with control buttons.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Hi,
I have to communicate with PC via USB, I use PIC18F2550 I wanted to do a practical thing without the classic USB-SERIAL converter, there is a suitable library I think is very useful on several occasions.
I found a library with the JAL compiler ver.2 but it does not work well, the device is seen correctly by WIN but I can not communicate any data.
Gigi
I am not sure what the ask is. Are you asking we fix/resolve the JAL compiler issue?
No, you are already doing a huge job to keep GCB up to date, I wanted to find the possibility to transfer data from PIC to PC, having found nothing I looked around.
Unfortunately there is nothing that works, certainly it is very complex to create a library also because usb must constantly communicate with other devices.
Thank you,
Gigi
We have just released the first phase of USB support. See the C:\GCB@Syn\GreatCowBasic\Demos\usb_solutions\greatcowbasic_solutions\libwinusb_solutions directory
Whilst not tested explicitly with your part - it will work.
C:\GCB@Syn\GreatCowBasic\Demos\usb_solutions\greatcowbasic_solutions\libwinusb_solutions directory is not in my demos.
Please post a link to the latest demos...and help files. I loose track of where files are stored. Thanks.
Last edit: stan cartwright 2018-12-14
Yes, I've already seen this solution, interesting but it requires a dedicated program with relative DLL to manage communication, and if it is seen as a serial, it can be used with various programs. I have read several previous posts on the subject and I think there are problems with the recognition or rights of serial drivers or something like that, I did not understand well and unfortunately I do not know.
Gigi
@Gigi. I am confused.
In your first post you say 'without the classic USB-SERIAL converter' so, the USB demo and the related application meets that criteria.
Then you post 'g but it requires a dedicated program with relative DLL to manage communication, and if it is seen as a serial,'... It is NOT serial it is LIBK which you seem to understand in your reference to the DLL. There are no know issues with the 'recognition or rights of serial drivers' - did you try the demo?
I am asking as an advisor, so, please excuse my straight language, if English is not your first language. Do not be offended.
If you do not want to use USB-SERIAL converter and the LIBK solution is not OK - then, I think you are asking for the USB-CDC library for Great Cow BASIC? With this USB-CDC library is will be exposed to the PC as a serial port but without the 'classic USB-SERIAL converter' - Is this what you want?
Once we get the ask sorted - I can advise further.
Anobium
If you are on the latest release, they are there.
If not. Check GitHub.
I'm on 0.98.02 2018-05-10
Yes you are.
Where is latest version with usb demos?
I downloaded the demos on github twice and unzipped with win7 extract all...gcb-demo-source-master and 7zip and both gave errors, file path to long was win7 extract all. 7zip was just error numbers.
The demos seem intact. downloaded twice.
On my PC they are here :
C:\GCB@Syn\GreatCowBasic\Demos\USB Solutions
but the version I have installed is:
0.98.04 RC02 2018-10-20 (Windows 32 bit)
So it may not have been released into the main download pages yet.
Before complaining and trying a lot of stuff it is always a good idea to follow the hint of Anobium and look here
http://gcbasic.sourceforge.net/Typesetter/index.php/Download :
0.98.03
8-)
I wasn't complaining. The demos download gave errors unzipping. Try.
I usually install new gcb updates on 2 laptops and a desktop pc when they're anounced on the forum. This laptop has gcb 98.03 in uninstall programs but the version in use is 98.02 ??
There's 90.01, 98.02, 98.02 rc05 and 98.03 in uninstall programs list.. but clicking on and uninstall says they're uninstalled. Normally the item is removed from the list when it's uninstalled.
The other 2 pcs are on 98.03. and have usb support demo.
I found libk from a search for free win usb driver.
I have some pics with usb to try but usb is new to me. I will try sending adc to the gcb terminal. The sort of thing that's easy with arduino boards and probably a 18f46k42 evaluation board.
My problem would be if I wanted to program my own windows interface. The only option for me would be free basic which seems to support libk and is all I can think of that's free and I can use. I did use free delphi once, probaly obsolete now.
github is a git to use.
edit- just downloaded latest gcb for this laptop. The uninstall previous isn't working so just erased. When new version installed pickit 2 and 3 plus are gone. Copied from other pc to usb stick then pasted to new version and after changing icons it's working again...phew.
It must be irritating having to put up with beginners. Sorry but that's what you get when you make something like pic programming simple for not expert people like me.
I like windows pretty pictures and mouse. I remember dos :)
...please don't suggest I try blocky gcb
I would never complain about gcb. Is there any other free pic/avr basic that's as useful as gcb? answers on a postcard to...
Last edit: stan cartwright 2018-12-15
I have programmed usb_ibkwinusb_16f1454 to chip ok. Awaiting 3 usb type 2 break out boards...the big ones like pickit 2 socket and printers. see then.
I found pickit3 programmer and pickit3plus programmed this chip ok. lvp l8r , this works. see photo 5 wires...works to.
I dunno when to use pickit3 or 2 hardware. Dunno if the 16f1454 can be programmed without pickit plus. northern software flashes a gcb hex file to this chip ok. pics are so mystical.
Until I mount the chip/socket etc I installed the 86 driver so what next?
what's the dll for?
what day is it?
edit- isn't pickit plus easy, 5 wires from ebay pickit3 to spare breadboard...even I can do this..and it worked first time. and there's irrellevent leds to confound you.
Last edit: stan cartwright 2018-12-15
Well you answered your own question but here is:
"A canned history of PICKit"
In ~2004 Microchip released the PICKit1 programmer. It was a development board and could program the , at that time, NEW flash based 8 and 14 pin Devices, and Microchip provided all of the Schematics and software for people to be able to use it as a reference design and build their own versions.
In ~2007 Microchip Released the PICKit2 as a Standalone ICSP (In Circuit Serial Programmer) with a separate Development board (Low Pin Count Board) that could accommodate any current 8, 14 or 20 Pin Microcontroller.
The great thing about PICKit2 was that it was a community effort and designed in collaboration with the users. As a result it was open source and open hardware.
PICKit2 was a raging success, with the community adding software features and Microchip adding device support. (If you haven’t yet done so try using a PICKit as a logic analyzer the hardware price is worth it for that community added feature alone).
In 2009 microchip did an about face and decided that Development tools should be a Profit Center and that Programmers should be proprietary software and closed hardware.
They released the PICKit 3 and it was a disaster. The Community rebelled against it and rather than listen to the community, and provide the required features, Microchip went the opposite way. To force People to purchase the NEW PICKit3 they stopped updating the PICKit2 and created a new version of the populer LPC Board. As a result Newer devices, most notably the PIC32 parts, required PICKit3 and MPLAB IPE in order to be programmed and all of the PICKit Lessons that use the LPC Board were changed to use a Proprietary C Compiler.
Under pressure Microchip finally released the PICKit3 version of the PICKit2 GUI but, rather than add features, it turns the PICKit3 into an inferior Clone of the PICKit2 and only supports a subset of the PICKit2 devices. It also loses the ability to program any of the newer devices.
The PICKit2 community ignored the PIC32 devices but continued to update the 8 bit parts database, despite microchip withdrawing support, until Microchip changed the Programing Protocols inside the newer 8 bit devices to make PICKit2 completely obsolete.
Roll on 2018 and Microchip have still not learnt their Lesson. They release the even more proprietary, and slower, PICKit4 programer that now needs all 5GB of MPLabX to be installed just to flash an 8 pin chip.
A Call to Arms
Our Hero, Anobium, along with the PICKit fans as a whole decided that this was enough.
With Anobium leading the charge they Reverse engineered the workings of all of the PICKit Models, and all of the New Programming Protocols that Microchip had introduced in their effort to obsolete each predecessor version version of PICKit.
They came up with the PICKit+ Software that can use any PICkit Device you may own to, Program any Microchip Device that is supported by Great Cow BASIC.
And I might add a good many that are not supported by GCBASIC, including PIC32.
PICKit+ directly addresses all of the problems, and confusion, caused by Microchips mangled marketing of support products and gives Students, Hobbyists and anyone needing a fast prototype, access to a Lightweight IDE, Fast and easy to learn Compiler and the convenience of Using any of the Millions of PICKit2 programmers and Clones that are sitting in people's Junk Boxes and orphaned by Microchip.
Whilst Microchip were not initially happy about PICKit+, hence it having to be a seperate project and donation based, so that it avoids licensing issues and allows Microchip to continue Supporting GCBASIC as an open source project, they are begging to see the need for an easy to use accessible Hobby/student programing tool.
Conclusion
What you have experienced Stan, and many others like you, is a practical example of the above.
Confusion , Acceptance, and then Enlightenment.
When you saw the power of PICKit+, all of the confusion fell away and the Original Concept of 5 wire ICSP was once again both obvious and enjoyable.
Cheers
Chris
Last edit: Chris Roper 2018-12-16
Thank you Chris.
Not been called a Hero before. :-)
And, to add. PICKit+ will shortly be fully integrated into MPLAB-X IDE. Guess who wants to integrate it...... Microchip. So, you will be able to use MPLAB-X to program any microcontroller via a PK2 or a PK3 - I am not saying you can get the PK2 or a PK3 debugger running from witnin MPLAB-X but to program via a PK2 or a PK3 is a step in the right direction.
That is good news and another feather in your cap.
Even If you dont think you are a hero the powers that be have seen the futility of opposing you and are willing now to embrase PICKit again.
That is a move that no one has forseen.
@Anobium
Maybe we do not understand each other well, it's also my fault that I do not know the problem well and also of communication with automatic translator.
I do not know LIBK, can you give me some other information?
Yes, I meant USB-CDC library for Great Cow BASIC
Anyway I want to try the LIBK library provided with GCB well before making further comments, I hope that goes well.
Thank you
Gigi
LIBk: We have provided in the demonstration the project to enable the exposure of the LIBk methods. I included communications and recovery in the windows project, and, in the Great Cow BASIC project how to send and receive.
The big benefit of LIBk over CDC is the recovery. LIBk can recover from disconnects and insertion. CDC, unless the serial program is very very very clever will loose communications upon a disconnect, and, communinication can start until the CDC (virutal com port) is active. This is why we started with a robust library based on LIBk.
Good Luck.
@Stan. Unless you know what the goal of your USB project is... you will be sorely disappointed. The demonstration shows how to use LIBk to create working Windows EXE (also provided) to read and set the ADCs and LEDs respectively within the attached microcontroller.
So, if you want to see the demo work - where the EXE talks the microcontroler then this should work and you will learn that USB between a PC and microcontroller using Great Cow BASIC works.
If you want then venture into the Windows EXE project you will learn how to adapt the communications via the USB to add more capabilites such as remote control (via the USB) of PWM, more LEDs etc etc. You will need to use Microsoft Visual Studio or SharpDevelop for this.
Enjoy
Thanks Chris for the unbiased potted history. It's was new to me.
I've never used c++ but tried asm using parallel printer port programmer..from ETI magazine and I think Icprog worked.
I used a pc serial lead to program picaxe and nothing else.
Usb is something I take for granted - plug n play but it will be interesting.
My 3d printer uses an arduino 8 bit controller and can be controlled with usb and win program.
It's quite impressive.
https://www.youtube.com/watch?v=CDlj0jBtYmQ
I searched freebasic usb and found a link to libk on source forge but also post about using freebasic with arduino.
I connected a uno, it was on com7 and tried this fb program but no send back program on the arduino. It ran without error.
If I sent an "a" the arduino could check and turn a port on, a "b" another port.
This seems too easy. What's needed for a pic with usb to do the same?
That code would work with any PIC, or any other device with a USART.
Nothing in that code is USB and, whilst you have not shown your Arduino Code I would hazard a guess that nothing in that code relates to USB either.
Do not confuse an Arduino Board with a PIC chip.
An Arduino is an ecosystem with an AVR ATMega Device connected to a USB/Serial Bridge in an external package.
The Comparable PIC board would be the Curiosity or the XPress Evaluation board.
Try your code on one of those and it will work just as well as on the arduino.
Or just attach an external USB/Serial Bridge to any PIC for the same results.
USB is a totally Different animal and most USB Protocol Stacks actually consume more Memory than Most 8 Bit Microcontrollers have available. Hence USB devices normally being dedicated to USB/Serial conversion. Keyboard Scanning or Mouse Movement.
It is the Realm of the 32 and 64 bit devices from Qualicom and Cortex where you have sufficient resources for USB to be just another peripheral. USB was designed for PC’s not Microcontrollers and the Microcontrollers that are released with USB are intended to create simple peripherals to PC’s not to use USB as a USART replacement.
So in conclusion, the above can be done on any PIC, but if the above were done on any USB device, PIC or other brand 8 Bit device, you would have little or no memory left to do anything other than toggle the pins under PC control.
Cheers
Chris
Last edit: Chris Roper 2018-12-17
Thanks. I thought pic usb would be limited to what can be done with usb-ttl adaptor.
I didn't find much searching for pic-usb-windows-freebasic.
If you see a mega2560 running a 3d printer from usb it's impressive, controlling bed and nozzle temp and 4 steppers with precision and a lcd with control buttons.