Author: [email protected]
Date: Thu Mar 19 16:23:03 2009
New Revision: 875

Added:
    trunk/test/board/board_18f2450_af.jal
Modified:
    trunk/test/peripheral/usb/test_usb_cdc.jal
    trunk/test/peripheral/usb/test_usb_hid_generic.jal
    trunk/test/peripheral/usb/test_usb_hid_keyboard.jal
    trunk/test/peripheral/usb/test_usb_hid_mouse.jal

Log:
Initial USB support for 18f2450

Added: trunk/test/board/board_18f2450_af.jal
==============================================================================
--- (empty file)
+++ trunk/test/board/board_18f2450_af.jal       Thu Mar 19 16:23:03 2009
@@ -0,0 +1,121 @@
+-- ------------------------------------------------------
+-- Title: BOARD FILE for [see filename]
+-- Author: Albert Faber, Copyright (c) 2008..2008, all rights reserved.
+-- Adapted-by:
+-- Compiler: >=2.4g
+--
+-- This file is part of jallib  (http://jallib.googlecode.com)
+-- Released under the BSD license  
(http://www.opensource.org/licenses/bsd-license.php)
+--
+-- Description: This file defines the configuration of a specific  
test-board.
+-- --
+-- BOARD DESCRIPTION
+-- -----------------
+-- --
+-- This file is the setup for my homebrew, PICDEM like 18f2550 board
+-- The board consist of a reset button switch to gnd (tied to pin1, with  
4k7 pull up)
+-- A program button switch to gnd (tided to pin24, with 4k7 pull up)
+-- A 20 MHz external crystal and 15pf caps connected to OSC1/2
+-- pin 14 (Vusb) with a 220 nF capacitor to the ground
+-- The connection between PC and the 18F2450
+-- +5v to power the board
+-- data- wire to pin 15 (D-)
+-- data+ wire to pin 16 (D+)
+-- ground wire to the Vss of the PIC
+--
+-- In addition, a MAX232 chip connccted to the USART pins, for serial  
(mainly to debug)
+-- communication.
+-- The board is loaded with the standard microchip bootloader, therefore  
the examples
+-- are compiled with the following JAL compiler flags: -loader18 -no-fuse
+--
+-- Sources:
+-- Sources: http://www.microchip.org for PICDEM docs
+--
+-- Notes:
+--
+-- ------------------------------------------------------
+
+-- This board is used as a reference while generating samples
+;@jallib preferred
+
+;@jallib section chipdef
+-- chip setup
+include 18f2450
+
+-- even though the external crystal is 20 MHz, the configuration is such  
that
+-- the CPU clock is derived from the 96 Mhz PLL clock (div2), therefore set
+-- target frequency to 48 MHz
+pragma target clock       48_000_000
+
+
+-- fuses
+pragma target PLLDIV           DIVIDE_BY_5__20MHZ_INPUT_
+pragma target CPUDIV           _OSC1_OSC2_SRC___1__96MHZ_PLL_SRC___2_
+pragma target USBPLL           CLOCK_SRC_FROM_96MHZ_PLL_2
+pragma target OSC                      HS_PLL
+pragma target FCMEN                    DISABLED
+pragma target IESO                     DISABLED
+pragma target PWRTE                    DISABLED        -- power up timer
+pragma target VREGEN           ENABLED         -- USB voltage regulator
+pragma target VOLTAGE          V20                     -- brown out voltage
+pragma target BROWNOUT         DISABLED        -- no brownout detection
+pragma target WDTPS                    P32768          -- watch dog saler 
setting
+pragma target WDT                      DISABLED    -- no watchdog
+pragma target PBADEN           DIGITAL         -- digital input port<0..4>
+pragma target LPT1OSC          DISABLED        -- low power timer 1
+pragma target MCLR                     EXTERNAL        -- master reset on RE3
+pragma target STVR                     DISABLED    -- reset on stack 
over/under flow
+pragma target LVP                      DISABLED    -- no low-voltage 
programming
+pragma target ENICPORT         DISABLED        -- In circuit debugger
+pragma target XINST                    ENABLED         -- extended instruction 
set
+pragma target BACKBUG          DISABLED        -- background debugging
+pragma target CP_0                     DISABLED        -- code block 0 not 
protected
+pragma target CP_1                     DISABLED        -- code block 1 not 
protected
+pragma target CPB                      DISABLED        -- bootblock code not 
write protected
+pragma target WRT_0                    DISABLED        -- table writeblock 0 
not protected
+pragma target WRT_1                    DISABLED        -- table write block 1 
not protected
+pragma target WRTB                     DISABLED        -- bootblock not write 
protected
+pragma target WRTC                     DISABLED        -- config not write 
protected
+pragma target EBTR_0           DISABLED        -- table read block 0 not 
protected
+pragma target EBTR_1           DISABLED        -- table read block 1 not 
protected
+pragma target EBTRB            DISABLED        -- boot block not protected
+
+
+;@jallib section led
+-- LED IO definition
+var bit led             is pin_b3
+var bit led_direction   is pin_b3_direction
+var bit led2            is pin_b1
+var bit led2_direction  is pin_b1_direction
+
+;@jallib section serial
+const serial_hw_baudrate = 115_200
+
+
+
+;@jallib section lcd_hd44780_4
+-- LCD IO definition
+var bit lcd_rs           is pin_b4              -- LCD command/data select.
+var bit lcd_rs_direction is pin_b4_direction
+var bit lcd_en           is pin_b0              -- LCD data trigger
+var bit lcd_en_direction is pin_b0_direction
+
+var byte lcd_dataport is porta_low              -- LCD data  port
+var byte lcd_dataport_direction is porta_low_direction
+const byte LCD_ROWS     = 2                     -- 2 lines
+const byte LCD_CHARS    = 16                    -- 16 chars per line
+
+;@jallib section i2c
+-- I2C io definition
+var volatile bit i2c_scl            is pin_b4
+var volatile bit i2c_scl_direction  is pin_b4_direction
+
+-- b3 is pin-compatible with 16f648a board file, b1 is on hardware pins
+;var volatile bit i2c_sda            is pin_b3
+;var volatile bit i2c_sda_direction  is pin_b3_direction
+var volatile bit i2c_sda            is pin_b1
+var volatile bit i2c_sda_direction  is pin_b1_direction
+
+;@jallib section ccp
+-- ccp setup
+var volatile bit pin_ccp1_direction is pin_c2_direction

Modified: trunk/test/peripheral/usb/test_usb_cdc.jal
==============================================================================
--- trunk/test/peripheral/usb/test_usb_cdc.jal  (original)
+++ trunk/test/peripheral/usb/test_usb_cdc.jal  Thu Mar 19 16:23:03 2009
@@ -370,8 +370,6 @@
  include usb_drv_cdc_class
  include usb_drv

-TRISD = 0b0000_0000
-
  -- constants
  const  byte str_welcome[] = "1234JAL USB CDC RS-232 emulation demo version  
0.30 (JALLIB)\nplease wait (takes ~10 seconds) before the device is fully  
configured"
  const  byte str_cdc_welcome[] = "\nJAL USB CDC RS-232 echo demo,  
characters will be echoed\n"

Modified: trunk/test/peripheral/usb/test_usb_hid_generic.jal
==============================================================================
--- trunk/test/peripheral/usb/test_usb_hid_generic.jal  (original)
+++ trunk/test/peripheral/usb/test_usb_hid_generic.jal  Thu Mar 19 16:23:03  
2009
@@ -375,7 +375,6 @@
          if ( num_timer_ints == 400 ) then
                        -- send ADC event
                        hid_tx_buffer[ 0 ] = 0x13
-                       hid_tx_buffer[ 1 ] = PORTD
                        
                        sendTx = true
                end if
@@ -498,12 +497,7 @@

                        0x03:
                        block
-                               LATD = hid_tx_buffer[ 1 ]
                                if defined( HAS_SERIAL_DEBUG_PORT ) == true then
-                                       serial_hw_write( "%" )
-                                       print_byte_hex(serial_hw_data, LATD )
-                                       print_byte_hex(serial_hw_data, PORTD )
-                                       serial_hw_write( "%" )
                                end if
                        end block

@@ -535,7 +529,6 @@
  -- set port A and B to inputs
  PORTA_direction  = 0b_1111_1111
  PORTB_direction  = 0b_1111_1111
-PORTD_direction  = 0b_0000_0000




Modified: trunk/test/peripheral/usb/test_usb_hid_keyboard.jal
==============================================================================
--- trunk/test/peripheral/usb/test_usb_hid_keyboard.jal (original)
+++ trunk/test/peripheral/usb/test_usb_hid_keyboard.jal Thu Mar 19 16:23:03  
2009
@@ -477,10 +477,6 @@
  include usb_drv


-
-
-TRISD = 0b0000_0000
-
  -- constants
  const  byte str_welcome[] = "JAL USB Keyboard HID demo version  
0.02\nplease wait (takes ~20 seconds) before the device is fully configured"


Modified: trunk/test/peripheral/usb/test_usb_hid_mouse.jal
==============================================================================
--- trunk/test/peripheral/usb/test_usb_hid_mouse.jal    (original)
+++ trunk/test/peripheral/usb/test_usb_hid_mouse.jal    Thu Mar 19 16:23:03  
2009
@@ -300,9 +300,6 @@
  include usb_drv_core
  include usb_drv

-TRISD = 0b0000_0000
-
-
  -- constants
  const sbyte dir_table[] = {-4,-4,-4, 0, 4, 4, 4, 0}
  const  byte str_welcome[] = "JAL USB HID MOUSE DEMO version 0.3\nplease  
wait (takes ~20 seconds) before the device is fully configured"

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to