PIC18F14K50 and USB
Moderators: David Barker, Jerry Messina
PIC18F14K50 and USB
Is the PIC18F14K50 supported on swordfish? I'm specificly interested in USB support
Hmmm..
Have a look here on the wiki: http://www.sfcompiler.co.uk/wiki/pmwiki ... ionHistory. The PIC18F14K50 is included in the download.
-
- Registered User
- Posts: 26
- Joined: Sun Oct 12, 2008 11:21 pm
- Location: Utah
I have had a couple of 14K50's for awhile, finally came up with a project. I am getting assembler errors (Illeagle Opcode). The program assembles fine when i use a 46K20 as the chip, I get the errors when i use the 13K50 or 14K50. This is a bit of the listing file where the errors start. Any thoughts on why i get these errors.
RD
Code: Select all
00000022 00936 M3_U01 EQU 34
00000023 00937 M4_U16 EQU 35
00000024 00938 M4_U16H EQU 36
0000 00939 ORG 0X00
Error[122] : Illegal opcode (SBCDSTD)
0000 00940 GOTO SBCDSTD
0008 00941 ORG 0X08
0008 00942 SBDLYMS
Error[108] : Illegal character (5)
0008 00943 CLRF 5,0
0008 00944 SBDLYMS16
Error[108] : Illegal character (4)
0008 00945 MOVWF 4,0
Error[108] : Illegal character (2)
0008 00946 MOVLW 255
Error[108] : Illegal character (4)
0008 00947 ADDWF 4,1,0
I dont think that USB support is implemented for the 18F14K50. Microchip has changed deeply their USB stack (firmware) to support the 18FxxKxx series (and PIC24xx), and at my knowledge, SF implements only firt version of Microchip firmware.
You may need to check the diff between first(v2) and second (v3) version of USB firmware from Microchip.
Regards
You may need to check the diff between first(v2) and second (v3) version of USB firmware from Microchip.
Regards
-
- Registered User
- Posts: 26
- Joined: Sun Oct 12, 2008 11:21 pm
- Location: Utah
Not sure if you are replying to me or to the first gentleman. The program i am trying only has the USART, and Analog modules in it, no USB. It simply reads analog inputs and sends them out serially.
Here is the code.
RD
Here is the code.
Code: Select all
Device = 18F14K50
Clock = 16
Config
FOSC = IRC
// uses USART and AD libraries...
Include "USART.BAS"
Include "ADC.bas"
Include "convert.bas"
// variables
Dim ADMvolts(4) As Word 'read counts x RefCntPerMvolt
Dim PumpOn As Boolean 'toggles above and below 6 volts on AN1
Dim CalVolts As Word
//aliases
Dim Analog1 As PORTB.4
Dim Analog2 As PORTC.2
Dim Analog3 As PORTC.1
Dim Analog4 As PORTC.0
Dim DigOut As PORTB.6 'digital output for aux funtion (camera?)
Const CR = 10
Const LF = 13
// read the AD port and scale for 0 - 5 volts, calc volt divider scale
Sub ADInAsVolt()
'using Vdd (5v) as ref, using 10k, 3.3K volt divider, actual volts / .33
'5000 mvolts = 1024 counts 5000/1024 = 4.883 mvolts/count
'1/.33 * mvolts = acutal volts before volt divider
'100/33 = 1/.33
CalVolts = ADC.Read(10) * 5000 / 1024 'read volts on an10 (AN1 input)
ADMvolts(0) = (CalVolts * 100)/33
CalVolts = ADC.Read(6) * 5000 / 1024 'read volts on an6 (AN2 input)
ADMvolts(1) = (CalVolts * 100)/33
CalVolts = ADC.Read(5) * 5000 / 1024 'read volts on an5 (AN3 input)
ADMvolts(2) = (CalVolts * 100)/33
CalVolts = ADC.Read(4) * 5000 / 1024 'read volts on an4 (AN4 input)
ADMvolts(3) = (CalVolts * 100)/33
End Sub
Sub SerialOut()
USART.Write ("DATA,",PumpOn,",",ADMvolts(0),",",ADMvolts(0),",",ADMvolts(0),",",ADMvolts(0),CR,LF)
End Sub
'set oscilator options, internal 16MHz
OSCCON = %01110000 'use 16MHz internal oscilator, select HFINTOSC for FOSC
'set up analog pins
ADCON2 = %10000000 'right justified 10 bit results, Clock setup --- TAD = 0, FOSC/2
ADCON1 = %00000000 'using Vdd,Vss as ref
ADCON0 = %00000001 'turn on A/D unit
ANSEL = %01110000 'select an4,an5,an6 as analog
ANSELH = %00000100 'select an10 as analog
'set up tris bits
TRISB.7 = 0 'serial port out
TRISB.5 = 1 'serial port in
TRISB.6 = 0 'digital ouput
TRISB.4 = 1 'analog 10 input
TRISC.0 = 1 'analog 4 input
TRISC.1 = 1 'analog 5 input
TRISC.3 = 1 'analog 6 input
'set uart baud rate
SetBaudrate(br19200)
Low(DigOut) 'turn off digital output on boot
// main program loop...
While true
'ADInAsVolt 'read the analog inputs
If ADMvolts(0) >6000 Then 'over 6 volts says pump running
If PumpOn = false Then
SerialOut 'send analog values at pump start
PumpOn = true
High (DigOut) 'digital output on
End If
Else
If PumpOn = true Then
PumpOn = false
SerialOut 'send analog values at pump stop
Low (DigOut) 'digital output off)
End If
End If
DelayMS(500) 'wait 1/2 second
Wend
End
RD,
I could not get your code to compile as well.
Even a simple blink code will not compile without errors.
But I think I know the problem. You need a newer version of the MPASMWin.exe that is located in the Bin folder.
On my computer I have MPLAB v8.0 (it is not the latest but) copy MPASMWin. exe from there to the bin folder.
Swordfish version was 5.11, MPLAB version is 5.14.
At least my blink compiles without errors so hopefully yours will too.
RKP
I could not get your code to compile as well.
Even a simple blink code will not compile without errors.
But I think I know the problem. You need a newer version of the MPASMWin.exe that is located in the Bin folder.
On my computer I have MPLAB v8.0 (it is not the latest but) copy MPASMWin. exe from there to the bin folder.
Swordfish version was 5.11, MPLAB version is 5.14.
At least my blink compiles without errors so hopefully yours will too.
RKP
-
- Registered User
- Posts: 26
- Joined: Sun Oct 12, 2008 11:21 pm
- Location: Utah
PIC18F14K50 and USB
PIC18F14K50 and USB
Translation by Google, sorry.
Hello, the sheet says that the chip has a USB interface.
Unfortunately, he is disabled in the inludes file.
Can we change this with the new data from Microchip?
Here are some of the data sheet.
Universal Serial Bus Features:
Universal Serial Bus Features:
• USB V2.0 Compliant SIE
• Full Speed (12 Mb/s) and Low Speed (1.5 Mb/s)
• Supports Control, Interrupt, Isochronous and
Bulk Transfers
• Supports up to 16 Endpoints (8 bidirectional)
• 256-byte Dual Access RAM for USB
• Input-change interrupt on D+/D- for detecting
physical connection to USB host
I want to use this chip because it is the smallest with USB.
with best regards
Speed64
Translation by Google, sorry.
Hello, the sheet says that the chip has a USB interface.
Unfortunately, he is disabled in the inludes file.
Can we change this with the new data from Microchip?
Here are some of the data sheet.
Universal Serial Bus Features:
Universal Serial Bus Features:
• USB V2.0 Compliant SIE
• Full Speed (12 Mb/s) and Low Speed (1.5 Mb/s)
• Supports Control, Interrupt, Isochronous and
Bulk Transfers
• Supports up to 16 Endpoints (8 bidirectional)
• 256-byte Dual Access RAM for USB
• Input-change interrupt on D+/D- for detecting
physical connection to USB host
I want to use this chip because it is the smallest with USB.
with best regards
Speed64
-
- Registered User
- Posts: 26
- Joined: Sun Oct 12, 2008 11:21 pm
- Location: Utah
14K50 MPASM 5.33 Required
Just downloaded the latest update to the Swordfish compiler binary.
It replace my MPASM v5.33 with MPASM v5.11
v5.11 does not support the PIC18F14K50 parts.
results in hundreds of error messages.
Thought some might want to know this????
RD
It replace my MPASM v5.33 with MPASM v5.11
v5.11 does not support the PIC18F14K50 parts.
results in hundreds of error messages.
Thought some might want to know this????
RD
How to switch between USB speakers and headphones on vista? I just got usb speakers for my laptop. Sometimes i want to listen on the speakers and sometimes on the headphones. Is there any easy way to switch between them without having to unplug one, close the program, plug the other one in, re-open the program?
______________________________
external keyword tool ~ keyworddiscovery.com ~ keycompete.com ~ compete.com ~ webmasterworld.com
______________________________
external keyword tool ~ keyworddiscovery.com ~ keycompete.com ~ compete.com ~ webmasterworld.com
Last edited by plaressa on Sat Aug 07, 2010 7:05 am, edited 1 time in total.
-
- Posts: 4
- Joined: Sat Jun 12, 2010 8:44 am
- Location: UK