Your first example works fine for me. My serial port output is "0000
0000 0000 0000 0000 0000". and if I comment out the line "table[index]
= 0", I get "0005 0005 0005 0005 0005 0005 0005"

include 18f4550                    -- target PICmicro
--
-- This program assumes that a 20 MHz resonator or crystal
-- is connected to pins OSC1 and OSC2.
-- (unspecified configuration bits may cause a different frequency!)(
pragma target clock 20_000_000     -- oscillator frequency
-- configuration memory settings (fuses)
pragma target OSC  HS              -- HS crystal or resonator
pragma target PLLDIV  P1           -- PLL off
pragma target CPUDIV  P2           -- no cycle divisor
pragma target WDT  disabled        -- no watchdog
pragma target XINST disabled       -- not supported by JalV2
pragma target LVP  disabled        -- no Low Voltage Programming
pragma target MCLR external        -- reset externally
-- These configuration bit settings are only a selection, sufficient
for
-- this program, but other programs may need more or different
settings.
--
enable_digital_io()                -- make all pins digital I/O
--
include print

-- setup serial software
const serial_sw_baudrate = 38400
alias serial_sw_tx_pin is pin_B4
alias serial_sw_rx_pin is pin_B5
pin_B4_direction = output
pin_B5_direction = input
include serial_software
serial_sw_init()

var byte index
var word table[4] = {0,0,0,0}
index = 0
table[index] = 5
table[index] = 0

forever loop
   print_word_hex(serial_sw_data,table[index])
   serial_sw_data = " "
   _usec_delay(250)
end loop

On Sep 5, 1:07 pm, wikiwizz <[email protected]> wrote:
> Hello all,
>
> I am building my first project with Jal. The purpose is to ignite the
> lights for a sportsfield with delays. Not very difficult. I am using
> Picshell 2.02 for IDE and simulation (works fine but newest version
> 2.10 freezes at runtime) and Jal V2.4n.
> Up till now i like Jal and Picshell specially because these are open
> source and there seems to be an active community supporting beginners.
> In my efforts i came across two bugs (or am i doing somethin wrong?).
> I have not found out where i can submit these; i have looked around
> (search) and didn't find similar bugreports. So i put them here and
> maybe someone can help me to submit them to the correct procedure.
>
> First is a bug with word table variables. In the following code:
>
>   var byte index
>   var word table[4] = {0,0,0,0}
>   index = 0
>   table[index] = 5
>   table[index] = 0
>
> The instruction table[index] = 5 results in both bytes in memory that
> make out word[0] getting a value of 0x05. Instruction table[index] = 0
> results in the two bytes getting the value of the adress in memory of
> the first byte of word[0] (In my case 0x27)
>
> when i use
>
>   table[0] = 5
>   table[0] = 0
>
> it works as expected.
>
> The other bug is also with word table variables:
> In the following code:
>
>         index = 0
>         table[index] = 1000
>         while table[index] != 0 loop
>                 table[index] = table[index] - 1
>         end loop
>
> table[index] never becomes 0; the high byte of table[0] will not get
> below 0x01
> When i use the following workaround its ok.
>
>         index = 0
>         table[index] = 1000
>         while table[index] != 0 loop
>                 temp = table[index] - 1
>                 table[index] = temp
>         end loop
>
> So again:
> 1. am i doing something wrong with Jal being a newbe
> 2. if not can anyone concur my findings
> 3. point me to the proper procedure to submit these

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