Hi Abdykerim,
Error #1
There's 2 DoUSBIn, AND 2 DoUSBOute label, They are located at the bottom of your program...
Error #2,3,4,5,6,7,8,9,A,B,... Ok Ok
once you have commented the default config fuses in the 18F2455.INC file located PBP folder
... nothing else wrong happen IF AND ONLY IF YOU HAVE SELECTED THE RIGHT PIC IN THE DROP MENU AS WELL ...Code:;**************************************************************** ;* 18F2455.INC * ;* * ;* By : Leonard Zerman, Jeff Schmoyer * ;* Notice : Copyright (c) 2006 microEngineering Labs, Inc. * ;* All Rights Reserved * ;* Date : 06/05/06 * ;* Version : 2.47 * ;* Notes : * ;**************************************************************** NOLIST ifdef PM_USED LIST "Error: PM does not support this device. Use MPASM." NOLIST else LIST LIST p = 18F2455, r = dec, w = -311, w = -230, f = inhx32 INCLUDE "P18F2455.INC" ; MPASM Header ; __CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L ; __CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H ; __CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_512_2H ; __CONFIG _CONFIG3H, _PBADEN_OFF_3H ; __CONFIG _CONFIG4L, _LVP_OFF_4L & _XINST_OFF_4L NOLIST endif LIST EEPROM_START EQU 0F00000h BLOCK_SIZE EQU 32
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Yeah I found out there were 2 DoUSBin and 2 DoUSBout labels after I uploaded
the code. I deleted the bottom part of the code. I forgot to note that I use EasyHID too. In my PBP 2.46 folder the 18F2455.INC file looks like below:
;************************************************* ***************
;* 18F2455.INC *
;* *
;* By : Leonard Zerman, Jeff Schmoyer *
;* Notice : Copyright (c) 2004 microEngineering Labs, Inc. *
;* All Rights Reserved *
;* Date : 12/31/04 *
;* Version : 2.46 *
;* Notes : *
;************************************************* ***************
NOLIST
ifdef PM_USED
LIST
"Error: PM does not support this device. Use MPASM."
NOLIST
else
LIST
LIST p = 18F2455, r = dec, w = -311, f = inhx32
INCLUDE "P18F2455.INC" ; MPASM Header
;__CONFIG _CONFIG1L, _PLLDIV_5_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
;__CONFIG _CONFIG1H, _FOSC_HSPLL_HS_1H
;__CONFIG _CONFIG2H, _WDT_ON_2H & _WDTPS_128_2H
;__CONFIG _CONFIG3H, _PBADEN_OFF_3H
;__CONFIG _CONFIG4L, _LVP_OFF_4L & _ICPRT_OFF_4L & _XINST_OFF_4L
NOLIST
endif
LIST
EEPROM_START EQU 0F00000h
BLOCK_SIZE EQU 32
From the drop down menu I choose 18F2455 too. I can give a screen shot I did.
![]()
The code looks like:
'
' MyUSB
' =====
'
' File name : MyUSB.pbp
' Programmer: Abdykerim Mamedov
' Date : July 2, 2007
' Device : PIC 18F2455 & 4MHZ crystal
'
'
' Supposed to send and read from USB bus.
'
' Hardware:
' ---------
' Signal genarator (Sinusoidal,triangular or square wave)
' USB cable
' 4 MHZ crystal
'
'
' Software:
' ---------
' The PC interface is not ready yet, but supposed to be VB6 source code
'
'
' Pic Configuration Fuses
' =======================
@ ERRORLEVEL -230
asm
__CONFIG _CONFIG1L, _PLLDIV_1_1L & _CPUDIV_OSC1_PLL2_1L & _USBDIV_2_1L
; ; ; USB clock source comes from the 96 MHz PLL divided by 2
; ; [OSC1/OSC2 Src: /1][96 MHz PLL Src: /2]
; No prescale (4 MHz oscillator input drives PLL directly)
__CONFIG _CONFIG1H, _FOSC_XTPLL_XT_1H & _FCMEN_OFF_1H & _IESO_OFF_1H
; ; ; Oscillator Switchover mode disabled
; ; Fail-Safe Clock Monitor disabled
; XT oscillator, PLL enabled, XT used by USB
__CONFIG _CONFIG2L, _PWRT_ON_2L & _BOR_ON_2L & _BORV_2_2L & _VREGEN_ON_2L
__CONFIG _CONFIG2H, _WDT_OFF_2H
__CONFIG _CONFIG3H, _MCLRE_ON_3H & _LPT1OSC_OFF_3H & _PBADEN_OFF_3H & _CCP2MX_ON_3H
__CONFIG _CONFIG4L, _STVREN_ON_4L & _LVP_OFF_4L & _XINST_OFF_4L & _DEBUG_OFF_4L
endasm
DEFINE OSC 48
'
' Hardware configuration
' ======================
'
' I/O and PORTs
' -------------
TRISA.0 = 1 ' Set pin 0 of PORTA an input
'
' A/D converter
' -------------
ADCON0 = %00000001 ' Configuring Analog Channel Select bits ,
' A/D Conversion Status bit, A/D On bit
ADCON1 = %00001101 ' Configuring Voltage Reference Configuration bits,
' (AN0 analog, others digital), A/D Port Configuration Control bits
ADCON2 = %10001000 ' Configuring A/D Result Format Select bit (Right justified ),
' A/D Acquisition Time Select bits (4 TAD),
' A/D Conversion Clock Select bits (Fosc/64)
'
' USB module
' ----------
UCFG var byte EXT ' include UCFG register... Yeah Melabs didn't
ucfg = %00010100 ' enable internal USB pull-up, Full speed USB
'
' Interrupt definition
' ====================
' TMR0 interrupt used to keep USB connection alive
' by sending USBSERVICE at each 100uSec or so.
INTCON = %10100000 ' Enable global and TMR0 interrupts
T0CON = %10000000 ' TMR0, CLK internal, prescaler 1:2, T0ON
'
' Variables & constants definition
' ================================
USBBufferSizeTX con 8 ' input
USBBufferSizeRX con 8 ' output
USBBufferCount Var Byte '
USBBufferIn var byte[8] ' store incomming USB data
USBBufferOut Var Byte[8] ' store outgoing USB data
DataToSend var BYTE[8] ' store ADCs
@ADRead = ADRESL ; use to read both ADCs register in one shot
ADRead VAR WORD EXT ' make it available to use in PBP
'
' Constants definition
' ====================
TMR0IF VAR INTCON.2 ' TMR0 overflow int flag
TMR0ON VAR T0CON.7 ' TMR0 on/off bit
TMR0IE VAR INTCON.5 ' TMR0 interrupt enable/disable bit
GoDone var ADCON0.1 ' ADC conversion
'
' Macro(s) definition
' ===================
goto SwHwInit ' skip macros
Reload_TMR0:
TMR0ON = 0
TMR0L=65000
TMR0IF = 0
TMR0ON = 1
RETURN
asm
SendUSB macro array
; Use to Copy an specific array to USBBufferOut AND send it
; to USB bus
variable i=0
while i<8
MOVE?BB (array+i),(_USBBufferOut+i)
i+=1
endw
L?CALL _DoUSBOut
endm
endasm
'
' Software/Hardware initialisation
' ================================
SwHwInit:
pause 500 ' Settle delay
usbinit ' initialise USB
GOSUB Reload_TMR0 ; Reload timer0
ON INTERRUPT GOTO DoUSBService
'
' Main program start
' ==================
Start:
'
'
' Do ADC conversion and save it to specific DataToSend array
' ----------------------------------------------------------
PAUSEUS 125 ' arbitrary SamplingTime
GODONE=1 ' start conversion
WHILE GODONE : WEND ' wait 'till finish
DATATOSEND = ADREAD ' save it to DataToSend array
' Send data to USB bus
' --------------------
@ SendUSB _DataToSend
'
' Check if there's any incomming data
' -----------------------------------
gosub dousbin
'
' Redo from start
' ---------------
goto start
END
'
'
' Subroutines area
' ================
'
DoUSBIn:
'
' Check and receive data from the USB bus
' =======================================
tmr0ie = 0 ' disbale TMR0 int
USBBufferCount = USBBufferSizeRX ' RX buffer size
USBService ' keep connection alive
USBIn 1, USBBufferin, USBBufferCount, Timeout ' read data, if available
Timeout: '
GOSUB Reload_TMR0
tmr0ie = 1 ' re-enable TMR0 int
PORTB = USBBUFFERIN[0] ' output to PORTB
return
'
'
'
DoUSBOut:
'
' Send data to the USB bus & Wait for USB interface to attach
' ================================================== =========
TMR0IE = 0 ' Disable TMR0 interrupt
WaitPC: '
USBBufferCount = USBBufferSizeTX ' TX buffer size
USBService ' keep connection alive
USBOut 1, USBBufferOut, USBBufferCount, Waitpc ' if bus available, transmit data
GOSUB Reload_TMR0
tmr0ie=1 ' Re-Enable TMR0 interrupt
return
DISABLE
DoUSBService:
usbservice ' keep connection alive
GOSUB Reload_TMR0 ; reload timer
RESUME ' get out of here
ENABLE
I do not know what the problem is. The errors are not "dying". Isn't there anyone using PBP 2.46 down here. Maybe it's a common problem for 18F series.
Can anyone try this code and inform me?
Don't worry be happy....
what happen if you select PIC18F2550 or 18F4550?
Maybe it's a MPLAB/MPASM installation/Version issue ?
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
I use MPASM v.5.03 and MPLAB v.7.60.
I reinstalled MPLAB.
I tried both 2550 and 4550 too. Same errors with them too.
Don't worry be happy....
Still compile fine here...
Sure there's something weird in your PBP installation... well i think
Anybody here still have 2.46 and may compile all the above?
P.S.: to place your code in a window like i did, just type
[code]
Paste your code here
[/code]
Please check you p18F2455.INC file in MPASM SUITE folder and search for TRNIF...line 234 or so
Code:;----- UIR Bits ----------------------------------------------------- URSTIF EQU H'0000' UERRIF EQU H'0001' ACTVIF EQU H'0002' TRNIF EQU H'0003' IDLEIF EQU H'0004' STALLIF EQU H'0005' SOFIF EQU H'0006'
Last edited by mister_e; - 4th July 2007 at 16:26.
Steve
It's not a bug, it's a random feature.
There's no problem, only learning opportunities.
Bookmarks