Originally Posted by TissyI wasn't planning on using In Circuit Serial Programming at first, but if we can include a user-friendly firmware upgrade feature then that changes everything.Originally Posted by Bruce
Robert
Originally Posted by TissyI wasn't planning on using In Circuit Serial Programming at first, but if we can include a user-friendly firmware upgrade feature then that changes everything.Originally Posted by Bruce
Robert
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Ok, this is strange. I've downloaded the files from Microchip:
http://www.microchip.com/stellent/id...&part=DM163025
And these 3 files all install the same thing; MICROCHIP USB FRAMEWORK SOFTWARE:
- USB_Bootloader_Setup.EXE
- MCHPFSUSB_Setup
- HID_Setup.EXE
Do I have some sort of cookie problem going on? I've had something similar once with an old unzip program and was wondering if I was seeing straight.
Robert
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
OK. I haven't got the USB Demo board, i just use the 18F2550 and 18F4550.
I will have to look at this, because the device i am designing is a USB device. So it would be good to be able to flash it for an upgrade using this facility over USB without worrying about other IcSP connections etc.
Hi Everybody...
there is a schematic for Bruce's example...?
Sorry but my english is not good....!
Regards...!
GIO
Greetings from ECUADOR...!!!
Hi:
Can anybody helpme whit a elemental example....? Im usin EasyHID, PIC 18F4550, VB and PBP... thanx.
Lamento no poderme expresar bien en ingles, pero para alguien que me entienda, le estaria agradecido si me pudiera guiar con un ejemplo sencillo para un PIC 18F4550 con PBP VB y easyHID...
Gracias...!
Greetings from ECUADOR...!!!
Hello, i have a problem with usb. Here is the code:
PBP code:
DEFINE LOADER_USED 1 ' Using Mecanique 18f4550 loader
DEFINE OSC 20
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source /32
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
BufferSize con 8
DataBuffer Var Byte(BufferSize) ' data buffer
DataBufferCount Var Byte ' buffer size
Quanta con 1251
' Variables
X VAR byte
Adval VAR WORD
TRISA.0 = 1 ' RA0 input
ADCON1 = %00001110 ' A/D channel 0
ADCON2 = %10000011 ' Left justify for 10-bit
USBInit
Main:
ADCIN 0,adval ' Read A/D channel 0 into ADval variable
ADval = ADval */ Quanta ' Quanta result
' Load data buffer
DataBuffer(0) = Adval dig 3 'Y.LowByte
DataBuffer(1) = "."
dATAbUFFER(2) = Adval DIG 2
DataBuffer(3) = Adval DIG 1
DataBuffer(4) = aDVAL DIG 0
gosub DoUSBOut
for X = 0 to 99 ' Short delay between updates
pausEUS 1000
USBSERVICE ' Maintain HID connection during delay period
NEXT X
goto Main
' USB in...
DoUSBIn:
DataBufferCount = BufferSize
USBService
USBIn 1, DataBuffer, DataBufferCount, DoUSBIn
return
' USB out...
DoUSBOut:
DataBufferCount = BufferSize
USBService
USBOut 1, DataBuffer, DataBufferCount, DoUSBOut
return
end
-----------------------------------------------------------
VB code:
' vendor and product IDs
Private Const VendorID = 6017
Private Const ProductID = 2000
' read and write buffers
Private Const BufferInSize = 8
Private Const BufferOutSize = 8
Dim BufferIn(0 To BufferInSize)
Dim BufferOut(0 To BufferOutSize)
Dim voltaje As String
' ************************************************** **************
' when the form loads, connect to the HID controller - pass
' the form window handle so that you can receive notification
' events...
'************************************************* ****************
Private Sub Form_Load()
' do not remove!
ConnectToHID (Me.hwnd)
End Sub
'************************************************* ****************
' disconnect from the HID controller...
'************************************************* ****************
Private Sub Form_Unload(Cancel As Integer)
DisconnectFromHID
End Sub
'************************************************* ****************
' a HID device has been plugged in...
'************************************************* ****************
Public Sub OnPlugged(ByVal pHandle As Long)
If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then
' ** YOUR CODE HERE **
estado.Caption = "Plugged in"
End If
End Sub
'************************************************* ****************
' a HID device has been unplugged...
'************************************************* ****************
Public Sub OnUnplugged(ByVal pHandle As Long)
If hidGetVendorID(pHandle) = VendorID And hidGetProductID(pHandle) = ProductID Then
' ** YOUR CODE HERE **
estado.Caption = "Unplugged"
Label1.Caption = "Nothing"
End If
End Sub
'************************************************* ****************
' controller changed notification - called
' after ALL HID devices are plugged or unplugged
'************************************************* ****************
Public Sub OnChanged()
Dim DeviceHandle As Long
' get the handle of the device we are interested in, then set
' its read notify flag to true - this ensures you get a read
' notification message when there is some data to read...
DeviceHandle = hidGetHandle(VendorID, ProductID)
hidSetReadNotify DeviceHandle, True
End Sub
'************************************************* ****************
' on read event...
'************************************************* ****************
Public Sub OnRead(ByVal pHandle As Long)
' read the data (don't forget, pass the whole array)...
If hidRead(pHandle, BufferIn(0)) Then
' ** YOUR CODE HERE **
' first byte is the report ID, e.g. BufferIn(0)
' the other bytes are the data from the microcontroller...
voltaje = (CStr(BufferIn(1)) + "." + CStr(BufferIn(3)) + CStr(BufferIn(4)) + "V")
Label1.Caption = voltaje
End If
End Sub
'************************************************* ****************
' this is how you write some data...
'************************************************* ****************
Public Sub WriteSomeData()
BufferOut(0) = 0 ' first by is always the report ID
BufferOut(1) = 10 ' first data item, etc etc
' write the data (don't forget, pass the whole array)...
'hidWriteEx VendorID, ProductID, BufferOut(0)
End Sub
------------------------------------------------------------------
It doesnt work in visual basic, i only receive ".V" in the label, but i tested with the demo datalogger and it works. I dont know whats happened. Help me please
Thanks in advance
Last edited by Raflex; - 17th September 2006 at 17:54.
I'm no expert, but doesn't USB run at 48MHz?
Check out Bruce's code at Rentron and see what he does.
Robert
My Creality Ender 3 S1 Plus is a giant paperweight that can't even be used as a boat anchor, cause I'd be fined for polluting our waterways with electronic devices.
Not as dumb as yesterday, but stupider than tomorrow!
Hi. I have tested the communication with bruce's software and it works fine whit 20Mhz xtal. But with my code doesnt work.
Got it!!! Take a look:
VB code:
' vendor and product IDs
Private Const VendorID = 6017
Private Const ProductID = 2000
' read and write buffers
Private Const BufferInSize = 8
Private Const BufferOutSize = 8
Dim BufferIn(0 To BufferInSize) <---Mistake here, need to declare as byte !!!
Dim BufferOut(0 To BufferOutSize)
Dim voltaje As String
------------------------------------------------------------
I need to write 1000 lines with the next message:
"Dont forget declaration of variables" LOL
Hi i've recently begun experimenting with the 18F4550 i've got a working example program that lets me flash an led connected to PORTB.7, I use VB6 on the PC side.
Basically my project has been halted by an unexpected problem in compiling some code added to work the A/D. Both Bruce's USB_AD.zip example and my own code cannot compile this:
ADCON1 = %00001110 ' A/D channel 0
ADCON2 = %10000011 ' Left justify for 10-bit
I get a syntax error.... any ideas - full code posted below.
I'm running version 2.2.1.1 of microcode studio. I'm using the new beta program for the EPIC parallel programmer (with the 40 pin adapter)
DEFINE OSC 20
DEFINE LOADER_USED 1
'ADC defines
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source /32
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
Quanta con 1251
Adval VAR WORD
USBBufferSizeMax con 64 ' maximum buffer size
USBBufferSizeTX con 64 ' input
USBBufferSizeRX con 64 ' output
' the USB buffer...
USBBuffer Var Byte[USBBufferSizeMax]
USBBufferCount Var Byte
x VAR BYTE
TRISA.0 = 1 ' RA0 input
ADCON1 = %00001110 ' A/D channel 0
ADCON2 = %10000011 ' Left justify for 10-bit
usbinit ' initialise USB...
x = 0
LOW PORTB
BlinkLED:
if x = 7 then ProgramStart
x = x + 1
HIGH PORTB.7
PAUSE 1000
LOW PORTB.7
PAUSE 500
goto blinkLED
ProgramStart:
x = 0
gosub DoUSBIn
gosub DoUSBOut
goto ProgramStart
' ************************************************** **********
' * receive data from the USB bus *
' ************************************************** **********
DoUSBIn:
USBBufferCount = USBBufferSizeRX ' RX buffer size
USBService ' keep connection alive
USBIn 1, USBBuffer, USBBufferCount, DoUSBIn ' read data, if available
if usbbuffer[2] = 1 then
high portb.7
ENDIF
IF USBbuffer[2] = 0 THEN
LOW portb.7
ENDIF
goto DoAD
return
DoAD:
ADCIN 0,adval ' Read A/D channel 0 into ADval variable
ADval = ADval */ Quanta ' Quanta result
' Load data buffer
USBBuffer[0] = Adval dig 3 'Y.LowByte
USBBuffer[1] = "."
USBBuffer[2] = Adval DIG 2
USBBuffer[3] = Adval DIG 1
USBBuffer[4] = aDVAL DIG 0
RETURN
' ************************************************** **********
' * wait for USB interface to attach *
' ************************************************** **********
DoUSBOut:
USBBufferCount = USBBufferSizeTX ' TX buffer size
USBService ' keep connection alive
USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
return
Hello Rytech, your code is ok, i tried to compile it and it works. Probably you need a newer version of pbp or microcode studio.
Last edited by Raflex; - 10th June 2007 at 01:03.
I have PBP Compiler 2.46, Microcode studio 2.2.1.1 and version 4.21 beta of MeLabs Programmer software
Hopefully someone can comment on why my compiler doesnt know what ADCON1 & ADCON2 is for the 18F series chip.
If i take out ADCON2 and the usb stuff and compile for 16F877A it has no problems with ADCON1 - which to me suggest my support for a 18F4550 is buggered.
this compiles fine for the 16F877A:
DEFINE OSC 20
DEFINE LOADER_USED 1
'ADC defines
Define ADC_BITS 10 ' Set number of bits in result
Define ADC_CLOCK 3 ' Set clock source /32
Define ADC_SAMPLEUS 50 ' Set sampling time in uS
Quanta con 1251
Adval VAR WORD
USBBufferSizeMax con 64 ' maximum buffer size
USBBufferSizeTX con 64 ' input
USBBufferSizeRX con 64 ' output
' the USB buffer...
USBBuffer Var Byte[USBBufferSizeMax]
USBBufferCount Var Byte
x VAR BYTE
TRISA.0 = 1 ' RA0 input
ADCON1 = %00001110 ' A/D channel 0
'ADCON2 = %10000011 ' Left justify for 10-bit
'usbinit ' initialise USB...
x = 0
LOW PORTB
BlinkLED:
if x = 7 then ProgramStart
x = x + 1
HIGH PORTB.7
PAUSE 1000
LOW PORTB.7
PAUSE 500
goto blinkLED
ProgramStart:
x = 0
gosub DoUSBIn
gosub DoUSBOut
goto ProgramStart
' ************************************************** **********
' * receive data from the USB bus *
' ************************************************** **********
DoUSBIn:
USBBufferCount = USBBufferSizeRX ' RX buffer size
' USBService ' keep connection alive
' USBIn 1, USBBuffer, USBBufferCount, DoUSBIn ' read data, if available
if usbbuffer[2] = 1 then
high portb.7
ENDIF
IF USBbuffer[2] = 0 THEN
LOW portb.7
ENDIF
goto DoAD
return
DoAD:
ADCIN 0,adval ' Read A/D channel 0 into ADval variable
ADval = ADval */ Quanta ' Quanta result
' Load data buffer
USBBuffer[0] = Adval dig 3 'Y.LowByte
USBBuffer[1] = "."
USBBuffer[2] = Adval DIG 2
USBBuffer[3] = Adval DIG 1
USBBuffer[4] = aDVAL DIG 0
RETURN
' ************************************************** **********
' * wait for USB interface to attach *
' ************************************************** **********
DoUSBOut:
USBBufferCount = USBBufferSizeTX ' TX buffer size
'USBService ' keep connection alive
'USBOut 1, USBBuffer, USBBufferCount, DoUSBOut ' if bus available, transmit data
return
Try this:
'ADCON2 = %10000011 ' Left justify for 10-bit
Poke $fc0, $83 'which is the same thing as the line above.
Ok that compiled... with warnings...
Warning c:\progra~1\picbas~1\18F4550.inc 20: _CONFIG has been depreciated for PIC18 devices. Use CONFIG (repeated about 8 ti
does the fact that the "POKE" command compiled tell us why ADCON1 & ADCON2 would not?
Ok, so poke just manually writes values to the given registers?
I'd still like to figure out why ADCON1 & ADCON2 is not working.
ADCON1 = %00001110 ' A/D channel 0
'ADCON2 = %10000011 ' Left justify for 10-bit
Poke $fc0, $83 'which is the same thing as the line above.
Last edited by RYTECH; - 11th June 2007 at 00:19. Reason: I asked for the answer to a simple problem
Download Microcode Studio 3.0
http://www.mecanique.co.uk/code-studio/
This is now what I have installed
Version:
Microcode Studio 3.0
PBP 2.46 (w/patched 2.46 from support page)
MPASM v5.11
melabs Programmer Version 4.21 beta
PIC18F4550
no change to my situation.
ADCON1 = %00001110 ' A/D channel 0
ADCON2 = %10000011 ' Left justify for 10-bit
'Poke $fc0, $83 'which is the same thing as the line above.
compiling my code posted previously (no other changes) using the code above still causes a Syntax error.
'ADCON1 = %00001110 ' A/D channel 0
'ADCON2 = %10000011 ' Left justify for 10-bit
Poke $fc0, $83 'which is the same thing as the line above.
using the code above it compiles.
i'm new to poking ... I guess i've never had to directly write to any registers. I think i've peeked once.
Ok so I can deal with using POKE commands if they end up working to get my project moving along again.
Yeah if the peek and poke work thats fine for me, I had used ADCON commands before and am a little stumped about why it would work in once case for a certain PIC and not for another (the 18F4550). I knew it might be a matter of having support for the specific chip. i'm hoping other commands don't have syntax errors as i go...
I wonder if 2.47 resolves the Syntax error as I intend to start using the USB type 18Fxxxx type PICs
How do i find the microcontroller register address for ADCON0 - ADCON1 - ADCON2, is it in the datasheet? ( the sections describing A/D operation dont seem to list the address locations)
Last edited by RYTECH; - 11th June 2007 at 03:23.
Is there no downloadable version of Pic Basic Pro Upgrade 2.47. The shipping is like 3 times the cost of the cdrom!!
Probably the person who sell you the upgrade may do it for you?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Yeah I suppose I should ask about a downloadable version. I guess 50 bucks isn't all that much to pay for the upgrade in total.
I am trying to link my PC to my experimental board with PIC18F4550.
I am using EasyHID (mcHID.dll in delphi - for PC, and PROTON IDE for firmware from PIC) but the speed transfer of data from PC to PIC is very slow - about 64KB/sec.
I need more speed - I need over 240KB / sec. How can I make this data transfer to be fasterthan now?
Thank you
Sorry. These files are no longer available since the support applications you would need to install to use them have been discontinued.
Mecanique dropped the free version of EasyHID, and the VB6 version of Softwire is no longer available. Without these two applications, the .zip file would be useless.
See Mr E's USB example here: http://www.picbasic.co.uk/forum/showthread.php?t=5418
problem now will be the .dll. Not sure if we are allowed to distribute it
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
So basically now it's part of microcode studio right?
This confused me too for a bit till i saw it in Microcode studio's "view" menu.
And those having the old black installation CD... don't have this chance 'till now (december 18/2007)
Or once again, i still miss something... that's what happen when you're coming old.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
It's an ODD one.
Can't remember anyone UN-Releasing software that was once Free in the Public Domain.
Till now.
That's it, from now on, everyone must BUY Instant Interrupts. (NOT!)
Pffft!
<br>
DT
Would you also be shocked to find out that 10 million people got it for free ...
But now you have to pay for it? (cuz it turned out to be good)
<br>
DT
Yes, but businesses are also responsible for their decisions.
Once you make them, you can't just go, Oh I didn't mean that.
And, as far as the law goes ... once you put something in the Public Domain,
It's there to stay.
No court in the world would convict you for passing on the previously downloaded EasyHID.
I should mention, that I think it would be OK to do this if there were major improvements that warranted additional costs. But it's still the same program. No upgrades, no new features. Just, you don't get it, lest you pay now.
.
DT
Can't say that I particularly like or even agree with their method. You'll probably find that they had plans to sell it right from the time of its conception. By initially offering it for free -- it attracts a larger audience, some people find a "niche" for it in their toolbox, some may even become entirely dependent on it. For most people it's a "gotcha" -- they now must simply pay for it in order to continue using it. The vendor would make a tonne more money doing this than initially trying to sell it. Mainly because most people don't fall in love with a piece of software until they've come to grips with it. Even a $30 purchase for many people is enough to make them procrastinate about;
1. Will I learn this easily enough?
2. Will I ever really use this thing?
3. Does it really work a good as they say?
4. Will it do exactly what I want it to?
5. Maybe I can find something cheaper?
When something is for free, none of those things enter our minds -- instead we just give it ago because we have nothing to lose. So all told, they'll reap in a tonne of cash from basically all dependent users. That's life ...
Feel free to disagree with my marketing theory
Marketing Schmarketing.
You put software on the internet for free.
You allow all kinds of people to create programs that actually make that software useable.
Those people have invested MANY hours in developing your free product. (about 100 or so from me).
Once that product becomes popular, you go, ... Hey there's a lot of people that want this. I shouldn't be giving it away.
Hogwash!
Maybe it's time for DT_HID, or even TJ_HID.
<br>
DT
Bookmarks