How do I get a sample file on 18f452 for serial? I have tested it. It
is the same as sample 16f877a_serial_hardware.jal but with 18f452
chipdef.

Matt.

-- ------------------------------------------------------
-- Title: Test program for serial_hardware.jal
--
-- Author: Joep Suijs, 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: Test program for serial hardware lib
-- --
-- This file defines a test for JALLIB testing, using a test-board
--  defined by a BOARD file .
--
-- Sources:
--
-- Notes:
--    setup: a serial connection to a terminal
--
-- ------------------------------------------------------
--
-- This file has been generated from:
--    * board: board_16f877a_dwarf.jal
--    * test : test_serial_hardware.jal
--

-- include chip
include 18F452                   -- target picmicro

-- This program assumes a 20 MHz resonator or crystal
-- is connected to pins OSC1 and OSC2.
pragma target clock 20_000_000     -- oscillator frequency
-- configuration memory settings (fuses)
pragma target OSC  HS              -- HS crystal or resonator
pragma target WDT  disabled        -- no watchdog
pragma target LVP  disabled        -- no Low Voltage Programming

-- LED IO definition
alias led             is pin_b6
alias led_direction   is pin_b6_direction
alias led2            is pin_a1
alias led2_direction  is pin_a1_direction

include delay

-- set all IO as digital
enable_digital_io()

-- ok, now setup serial;@jallib section serial
const serial_hw_baudrate = 115_200
include serial_hardware
serial_hw_init()

include print                       -- output library

led_direction = output
for 4 loop
   LED = on
   delay_100ms(3)
   LED = off
   delay_100ms(3)
end loop



const byte str1[] = "Hello serial world"   -- define a string
print_string(serial_hw_data, str1)  -- output string to serial

-- inform user PIC is ready !
serial_hw_write("!")

-- let's build our loop
var byte char   -- will store received char
var word counter = 10
forever loop
        if serial_hw_read(char) then
                serial_hw_write(char)   -- that's the echo...
        end if

        counter = counter - 1;
        if (counter == 0) then
           counter = 50000
      serial_hw_data = "."
      LED = ! LED
   end if
end loop

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