Jan Willem wrote:
> Sorry for my bad englisch, but i try it.
> I have a 12F629 with a Wisp648 and JalV2. I can program my 12F629 with
> a sample .hex file. It is a .hex file that Pin7 go high en low (0V and
> 5V) every second (its working perfect) I have download it from www.voti.nl
> (http://www.voti.nl/blink/n_index.html).
> When i open the .jal file and i change the file to this:
>
> include 12f629 (i change this to my chip)
>
> var bit LED is pin_a0
> pin_a0_direction = output
> LED = high
There can be many reasons! Please post your whole program source in a
message, then we can better diagnose the problem.
Did you also try the 12F629_blink.jal sample from the Jallib collection?
Regards, Rob.
--
Rob Hamerling, Vianen, NL (http://www.robh.nl/)
Jan Willem wrote:
> In the map 'Files' a have place the zip '12F629 Blink_a_led'.
> Inclusive a screendump of my JALV2 program.
> I hope you can help me with this (probable little) problem.
I found your ZIP file.
It seems you are mixing 2 development environments: Wouter and Jallib.
That makes debugging difficult, not only for yourself but also for
people who would like to help you. Since you report your problem in
Jallib, you are supposed to report only problems with the Jallib
environment (otherwise go to Jallist).
>
> The code is now:
> include 12f629 -- target PICmicro
> include jlib
>
> enable_digital_io()
>
> var bit led is pin_A0
> pin_A0_direction = output
> --
> --forever loop
> led = on
> --_usec_delay(250000)
> --led = off
> --_usec_delay(250000)
> --end loop
This program looks like the 12f629_blink.jal sample in Jallib. Did you
try that *unchanged* ? It should work, it does here!
Remove the line with 'include jlib': that is not a Jallib library.
You don't need any library at all for this program!
You do need to specify some fuse_defs, why did you remove these?
pragma target CLOCK, OSC and WDT are really essential!
Why did you make the other changes above?
What do you expect this program to do now?
Effectively it is not more than:
> include 12f629 -- target PICmicro
> enable_digital_io()
>
> var bit led is pin_A0
> pin_A0_direction = output
> --
> led = on
A few question you should be able to answer:
What happens after the last statement?
Does the program end after the last statement?
Does it return, and if yes to what after the last statement.
Or are the memory locations after the last statement executed?
If so what is in those memory locations?
And if yes, what happens at end of memory? Does the program end, or does
it wrap around to the first program statement?
I fear you don't know any of the answers, otherwise you would not have
changed the program like you did. But this is elementary knowledge!
Have you any learning book for PICs? Any beginners book contains the
answers.
Back to the Jallib sample for this PIC. It should blink the led twice a
second. Try it and tell us what you see (or do not see what you expect).
Jan Willem wrote:
> Wich part of my program is from Wouter? The 12F629.jal file is your
> file, only the line 'include jlib' is from Wouter, but i have try to
> compile it without this line, compiling is OK, but the .hex file is
> not good. Pin A0 is not high.
That is exactly what I meant: jlib.jal is not a Jallib library. Why
would you add it? None of the Jallib blink samples use any library.
> Also i have try the tip from Albert, but also compiling OK, .hex not
> good (pin A0 not high).
> The example from jallib is with crystal, i use te internal crystal
> (WDT).
WDT has nothing to do with Oscillator.
There are blink samples in Jallib which use the Internal oscillator,
e.g. 12F509_blink.jal. Copy the fuse_defs to your program.
> Can you please give all .jal files wich need for compile a .hex file
> in JALv2 that make the pinA0 high?
NONE! No libraries needed for these simple blink programs!
> I can't find what i do wrong. Maybe i have the wrong JalV2 compiler?
Compiler 2.4l is OK.
> My chip is OK, because when i use the .hex file from the voti site,
> pinA0 is switch high and low every second!
Because your program is incomplete! And creating a program that does
*not* work is far much easier than creating one that does work, and
getting it to work as expected is a number of steps further!
>
> My code is now (but not working) with the 12F629 from jallib:
> ------------------------
> include 12f629 -- target PICmicro
>
> enable_digital_io()
>
> var bit led is pin_A0
> pin_A0_direction = output
> --
>
> forever loop
> led = on
> end loop
Of course it doesn't work when you don't specify the required fuse_defs
as I suggested in my previous message?
Try the following:
> --
> include 12f629 -- target PICmicro
> --
> -- This program uses the internal oscillator at 4MHz
> pragma target clock 4_000_000 -- oscillator frequency
> -- configuration memory settings (fuses)
> pragma target OSC INTOSC_NOCLKOUT -- internal oscillator
> pragma target WDT disabled -- no watchdog
> pragma target MCLR external -- reset externally
> --
> enable_digital_io() -- disable analog I/O (if any)
> --
> -- You may want to change the selected pin:
> alias led is pin_A0
> pin_A0_direction = output
> --
> forever loop
> led = on
> _usec_delay(250000)
> led = off
> _usec_delay(250000)
> end loop
Yes and written by Matt ! as you say, nice tutorial, highly detailed
and covers a lot, including jallib pack structure, programming,...
>
cheers
seb
Jan Willem wrote:
> I have try the code example of Rob. The code is nearby OK.
I don't understand the 'nearby'. I have actually tested my code on a
real 12F629 and it works OK. Maybe your 12f629 (or the port) is defect.
> The pinA0
> go not high, but i feel that the code is nearly OK. The fuses are
> really needed. I don't no what the bottleneck is now, but maybe you
> see?
Where should I look?
Note: If you would like us to help you, then you should make it as easy
and effective as possible for us. We don't want to waste our time on
having to collect info from elsewhere or guessing what you mean.
Jan Willem wrote:
> I have copy your code (the following) into my Jal Edit and i have
> compile it:
> ======================================================
> :020000040000FA
> :100000000508A200073099008316051083122214F8
> :100010002208850083120313FB30A000C630A10024
> :100020000A128A11A10B10280A128A11A00B0E289D
> :10003000000022102208850083120313FB30A00069
> :10004000C630A1000A128A11A10B22280A128A11B5
> :08005000A00B20280000062887
> :02400E00F4318B
> :00000001FF
> ======================================================
A compare shows that your hex file is exactly the same as mine (not
surprisingly!). Nevertheless I loaded it into my 12F629 and the led on
pin_A0 blinks as expected.
> When i load this .hex file into my 12F629 chip, pin A0 is not going
> high and low.
> You have tested your code (your .hex file) in your 12F629 chip en
> pinA0 is going high and low OK.
> Can you give me, or can you compare what the different is between your
> and my .hex file? The only reason that your code is working OK at your
> chip and not at my chip, is that your .hex file is not the same as
> my .hex file.
There must be another reason since the hex files are identical.
> PinA0 of my chip is OK, because when i load the .hex file of Wouter,
> pinA0 is going high and low.
I assume you used b675i-2.hex, I couldn't find any for the 12F629.
When I load this file into my 12F629 the led on A0 blinks as expected!
> I am very interesting what your .hex file is.
I'm afraid the problem is not with the hex file, and I have run out of
ideas what it could be!
funlw65 wrote:
> Hmm, guys you forgot about this:
>
> assembler
> -- ========================
> bsf _status, _rp0 -- bank 1
> -- ========================
> call 0x3ff -- get the factory calibrated OSC value
> movwf osccal -- for accurate timing
> -- ==================
> bcf _status, _rp0 -- bank 0
> -- ==================
> end assembler
You are right that OSCCAL should be loaded with the calibrated value in
that high-memory location. And not only for the 2 PICs you mention, but
also for a number of others. I have a note in my todo list: 10Fs,
12F508,509,510,519,629,675 and 16F505,506,630,676, maybe more.
I think a simple 'asm movwf OSCCAL' as very first instruction will be
enough, because with a reset the program counter is set to the last
memory location (e.g. DS41239D 4.7.1 and 9.2.2).
Changing OSCCAL is fine tuning, omitting OSC calibration will not be the
cause that a led doesn't blink at all, only the blink frequency may be a
bit different.
When an accurate frequency is a required an external oscillator is the
way to go.
We have discussed the OSCCAL issue in the begin-period of the Jallib
group and decided then to spend out time on more urgent things.
> Should be included in device file for 12F629 and 12F675.
And in some others, if in the device files at all. It requires
co-operation with the compiler, because the compiler decides where code
is store in memory. Maybe it should be a pragma.
> Also, you
> must pay attention at burning time, to not override that location of
> flash memory....
True, use a proper programmer!
Rob
I have been having a problem with, what I thought was with baud rate, in
a test file using the internal clock of the 16f628a. I noticed that
there was no OSCCAL in the device file. Not knowing for sure if that
(or me) was a problem, I grep'ed the svn device files for OCSCAL. I
come up with 289 devices with no OSCCAL in the files and 306 that have
OSCCAL in them.
Thought I must be mistaken as I did not realize you had done 'that' many
(595) devices, I just put it into my notes and continued to see if I
could get this k107 working.
Up till then I had been using 2 & 3 Terminal resonators but order some
20Mhz xtals Monday to see if maybe that is my problem. Live & learn.
Regards
Wayne
Wayne wrote:
> I have been having a problem with, what I thought was with baud rate, in
> a test file using the internal clock of the 16f628a. I noticed that
> there was no OSCCAL in the device file. Not knowing for sure if that
> (or me) was a problem, I grep'ed the svn device files for OCSCAL. I
> come up with 289 devices with no OSCCAL in the files and 306 that have
> OSCCAL in them.
>
> Thought I must be mistaken as I did not realize you had done 'that' many
> (595) devices, I just put it into my notes and continued to see if I
> could get this k107 working.
There are currently 'only' 306 device files in Jallib. When I grep
OSCCAL 17 of these appear to contain OSCCAL (306-289 = 17), and 16f628
is not among these.
>
> Up till then I had been using 2 & 3 Terminal resonators but order some
> 20Mhz xtals Monday to see if maybe that is my problem. Live & learn.
>
I have several test boards with USART using a resonator (16 and 20 MHz)
and didn't ever notice a communications problem which pointed to an
aberration of the frequency. Maybe I was lucky to have good resonators.