Hello Jallib techs,
I am in the process to make an JAL IDE program where I get this idea
and i
would like to share with you all.
I hope you all can add this information on all jal lib device files.
This is the sample of PIC10F200 device information.
; ==================================================================
; 10f200 Device Information, General Information
;
const byte DEVICE_ADC_CHANNEL = Not_Available ; How many adc
channel available
const byte DEVICE_DIRECTLCD = Not_Available ; Is direct
LCD pic functions available?
const byte DEVICE_CCP = Not_Available ; How many CCP
available?
const byte DEVICE_TIMER = 0b_0000_0001 ; Timer0
available. Value Timer0 to Timer5.
const byte DEVICE_UART = Not_Available ; Returns the
number UARTs
const bit DEVICE_SPI = False ; is spi available for
use?
const bit DEVICE_USB = False ; is usb available for
use?
const bit DEVICE_CAN = False ; CAN Bus
const bit DEVICE_PSP = False ; Par Slave Port
const bit DEVICE_COMP = False ; Comparator
const bit DEVICE_VREF = False ; Voltage Reference
const bit DEVICE_I2C_SLAVE = False ; is the device has
slave I2C?
const bit DEVICE_I2C_MASTER = False ; is the device has
master I2C?
;And i add these on chipdef.jal.
const byte Not_Available = 0
const byte LCD_SEGMENT24 = 24
const byte LCD_SEGMENT31 = 31
const byte LCD_SEGMENT42 = 42
const byte LCD_SEGMENT48 = 48
I can make use of these values on all program that i make, like:
if DEVICE_USB = True then
;call USB procedure.
end if
Sample of the 10f200.jal i edited.
; ==================================================================
; Title: JalV2 device include file for pic10f200
;
; Copyright (c) 2008 Rob Hamerling. All rights reserved.
;
; Compiler: JAL 2.4h
;
; This file is part of jallib
; (http://jallib.googlecode.com)
;
; Released under the BSD license
; (http://www.opensource.org/licenses/bsd-license.php)
;
; Sources:
; - x:/mplab814/mplab_ide/device/pic10f200.dev
; - x:/mplab814/mpasm_suite/lkr/10f200_g.lkr
;
; Notes:
; - Created with Dev2Jal Rexx script version 0.0.51
; - File creation date/time: 18 Oct 2008 20:47:09.
; - Edited by Mohammad Hafiz Othman for device information
;
; ==================================================================
;
; DataSheet: 41239
; Programming Specifications: 41228
; Vdd Range: 2.000-5.500 Nominal: 5.000
; Vpp Range: 10.000-12.000 Default: 11.000
;
; ==================================================================
include chipdef ; common constants
pragma target cpu pic_12 ; (banks = 1)
pragma target chip 10f200
pragma target bank 0x0020
pragma target page 0x0200
pragma stack 2
pragma code 256
pragma data 0x10-0x1F
var volatile byte _pic_accum at { 0x1E } ; (compiler)
var volatile byte _pic_isr_w at { 0x1F } ; (compiler)
const word _FUSES_CT = 1
const word _FUSE_BASE = 0xFFF
const word _FUSES = 0x0FFF
const word _ID_CT = 4
const word _ID_BASE[_ID_CT] = { 0x0100,0x0101,0x0102,0x0103 }
const word _ID[_ID_CT] = { 0x0000,0x0000,0x0000,0x0000 }
; ==================================================================
var volatile byte INDF at { 0x0 }
var volatile byte _ind at { 0x0 } ; (compiler)
; ==================================================================
var volatile byte TMR0 at { 0x1 }
; ==================================================================
var volatile byte PCL at { 0x2 }
var volatile byte _pcl at { 0x2 } ; (compiler)
; ==================================================================
var volatile byte STATUS at { 0x3 }
var volatile bit STATUS_GPWUF at STATUS : 7
var volatile bit STATUS_NTO at STATUS : 4
var volatile bit STATUS_NPD at STATUS : 3
var volatile bit STATUS_Z at STATUS : 2
var volatile bit STATUS_DC at STATUS : 1
var volatile bit STATUS_C at STATUS : 0
var volatile byte _status at { 0x3 } ; (compiler)
const byte _gpwuf = 7 ; (compiler)
const byte _not_to = 4 ; (compiler)
const byte _not_pd = 3 ; (compiler)
const byte _z = 2 ; (compiler)
const byte _dc = 1 ; (compiler)
const byte _c = 0 ; (compiler)
; ==================================================================
var volatile byte FSR at { 0x4 }
var volatile byte _fsr at { 0x4 } ; (compiler)
; ==================================================================
var volatile byte OSCCAL at { 0x5 }
var volatile bit*7 OSCCAL_CAL at OSCCAL : 1
; ==================================================================
var volatile byte GPIO at { 0x6 }
var volatile byte PORTA at GPIO
var byte _PORTA_shadow = PORTA
; ==================================================================
; 10f200 Device Information, General Information
;
const byte DEVICE_ADC_CHANNEL = Not_Available
const byte DEVICE_DIRECTLCD = Not_Available
const byte DEVICE_CCP = Not_Available
const byte DEVICE_UART = Not_Available
const byte DEVICE_TIMER = 0b_0000_0001
const bit DEVICE_SPI = False
const bit DEVICE_USB = False
const bit DEVICE_CAN = False ; CAN Bus
const bit DEVICE_PSP = False ; Par Slave Port
const bit DEVICE_COMP = False ; Comparator
const bit DEVICE_VREF = False ; Voltage Reference
const bit DEVICE_I2C_SLAVE = False
const bit DEVICE_I2C_MASTER = False
procedure _PORTA_flush() is
pragma inline
PORTA = _PORTA_shadow
end procedure
procedure PORTA'put(byte in x) is
pragma inline
_PORTA_shadow = x
_PORTA_flush()
end procedure
procedure PORTA_low'put(byte in x) is
_PORTA_shadow = (_PORTA_shadow & 0xF0) | (x & 0x0F)
_PORTA_flush()
end procedure
function PORTA_low'get() return byte is
return (PORTA & 0x0F)
end function
procedure PORTA_high'put(byte in x) is
_PORTA_shadow = (_PORTA_shadow & 0x0F) | (x << 4)
_PORTA_flush()
end procedure
function PORTA_high'get() return byte is
return (PORTA >> 4)
end function
var volatile bit GPIO_GPIO3 at GPIO : 3
var volatile bit pin_A3 at GPIO : 3
procedure pin_A3'put(bit in x at _PORTA_shadow : 3) is
pragma inline
_PORTA_flush()
end procedure
var volatile bit GPIO_GPIO2 at GPIO : 2
var volatile bit pin_A2 at GPIO : 2
procedure pin_A2'put(bit in x at _PORTA_shadow : 2) is
pragma inline
_PORTA_flush()
end procedure
var volatile bit GPIO_GPIO1 at GPIO : 1
var volatile bit pin_A1 at GPIO : 1
procedure pin_A1'put(bit in x at _PORTA_shadow : 1) is
pragma inline
_PORTA_flush()
end procedure
var volatile bit GPIO_GPIO0 at GPIO : 0
var volatile bit pin_A0 at GPIO : 0
procedure pin_A0'put(bit in x at _PORTA_shadow : 0) is
pragma inline
_PORTA_flush()
end procedure
; ==================================================================
var byte _TRISA_shadow = 0b1111_1111 ; default all input
procedure PORTA_direction'put(byte in x) is
pragma inline
_TRISA_shadow = x
asm movf _TRISA_shadow,W
asm tris 6
end procedure
procedure PORTA_low_direction'put(byte in x) is
_TRISA_shadow = (_TRISA_shadow & 0xF0) | (x & 0x0F)
asm movf _TRISA_shadow,W
asm tris 6
end procedure
procedure PORTA_high_direction'put(byte in x) is
_TRISA_shadow = (_TRISA_shadow & 0x0F) | (x << 4)
asm movf _TRISA_shadow,W
asm tris 6
end procedure
procedure pin_A3_direction'put(bit in x at _TRISA_shadow : 3) is
pragma inline
asm movf _TRISA_shadow,W
asm tris 6
end procedure
procedure pin_A2_direction'put(bit in x at _TRISA_shadow : 2) is
pragma inline
asm movf _TRISA_shadow,W
asm tris 6
end procedure
procedure pin_A1_direction'put(bit in x at _TRISA_shadow : 1) is
pragma inline
asm movf _TRISA_shadow,W
asm tris 6
end procedure
procedure pin_A0_direction'put(bit in x at _TRISA_shadow : 0) is
pragma inline
asm movf _TRISA_shadow,W
asm tris 6
end procedure
; ------------------------------------------------
var byte _OPTION_REG_shadow = 0b1111_1111 ; default all set
procedure OPTION_REG'put(byte in x) is
pragma inline
_OPTION_REG_shadow = X
asm movf _OPTION_REG_shadow,0
asm option
end procedure
procedure OPTION_REG_NGPWU'put(bit in x at _OPTION_REG_shadow : 7) is
pragma inline
asm movf _OPTION_REG_shadow,0
asm option
end procedure
procedure OPTION_REG_NGPPU'put(bit in x at _OPTION_REG_shadow : 6) is
pragma inline
asm movf _OPTION_REG_shadow,0
asm option
end procedure
procedure OPTION_REG_T0CS'put(bit in x at _OPTION_REG_shadow : 5) is
pragma inline
asm movf _OPTION_REG_shadow,0
asm option
end procedure
procedure OPTION_REG_T0SE'put(bit in x at _OPTION_REG_shadow : 4) is
pragma inline
asm movf _OPTION_REG_shadow,0
asm option
end procedure
procedure OPTION_REG_PSA'put(bit in x at _OPTION_REG_shadow : 3) is
pragma inline
asm movf _OPTION_REG_shadow,0
asm option
end procedure
procedure OPTION_REG_PS'put(byte in x at _OPTION_REG_shadow : 0) is
pragma inline
asm movf _OPTION_REG_shadow,0
asm option
end procedure
; ==================================================================
; Special device dependent procedures
; ---------------------------------------------------
; Switch analog ports to digital mode (if analog module present).
procedure enable_digital_io() is
pragma inline
OPTION_REG_T0CS = OFF ; T0CKI pin input + output
end procedure
; ==================================================================
; Symbolic Fuse definitions
; -------------------------
; addr 0xFFF
pragma fuse_def WDT 0x4 {
ENABLED = 0x4
DISABLED = 0x0
}
pragma fuse_def CP 0x8 {
DISABLED = 0x8
ENABLED = 0x0
}
pragma fuse_def MCLR 0x10 {
EXTERNAL = 0x10
INTERNAL = 0x0
}
>From this, you can search the PIC capability
and create suitable code.
This is much simpler. Hope to hear from you soon.
Regards,
Mohammad Hafiz Othman
[email protected]
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jallib" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jallib?hl=en
-~----------~----~----~----~------~----~------~--~---