Document fait avec Nvu Document made with Nvu
acceuilnouveautesintroductioncoeurmini_systemepages_techniquesrevue_de_presselienscourriel


specificationsinstructionslogicielsutilisationemulateurs

Use

Applications downloading
Example

Kernel downloading

There exist several tools developed by MICROCHIP ( http://www.microchip.com/developmenttools/ ) which allow to download an executable code. They use a connector having 5 signals:
  • VCC which is the power supply with 3.3 Volts or 5 Volts according to the type of microcontroler,
  • nMCLR which manages the initialization of the component,
  • PRGC which is the transmission clock of the program,
  • PRGD which is the serial data of the program,
  • and then GND for the ground.
It is enough to recover the core corresponding to the microcontroler and available in the software page.

Another method consists in using the emulator in combination with the RS232 to ICSP interface which allows in addition to dialoguing directly with the FORTH kernel of the microcontroler.


Applications downloading

Once the FORTH kernel installed in the microcontroler, the applications can be installed by using the FORTH interpreter  via the RS232 interface. This with the advantage of finding the flexibility of the FORTH but remains tiresome in the event of development of the applications with the disadvantage of a premature wear of the built-in memory.

Best is to use the emulator to develop the complete code containing at the same time the FORTH kernel and the applications, of the safeguard and to download it in only once time a new kernel.


Example

Let us take the case of a small application developed on one dsPIC30F4012. This appication is small a chenillard on RE0, RE1, RE2, RE3, RE4 and RE5 ports and of which speed is controlled by the RD0 and RD1 port state (0 for 500ms, 1 for 375ms, 2 for 250ms and 3 for 125ms).

That it is with the emulator or directly for the microcontroler, it is necessary to start by downloading the corresponding kernel dspic30f.hex.

Then, it is necessary to interpret the pilot of the ports for dsPIC30f ports_ABCDEFG_30f.txt.

It any more but does not remain to charge the following code:

DECIMAL

1 VARIABLE VOYANTS
1000 VARIABLE DUREE

( Instruction associated to the port D )
PRGHERE
]
    3 AND NEGATE 4+ 125 * DUREE !
    EXIT
[
CONSTANT PRG_PORT_D_B CONSTANT PRG_PORT_D_H

TACHE: T_CHENILLARD
    VOYANTS DUP >R @ DUP SORT_PORT_E 2/ DUP 0= 32 AND + R> !
    DUREE @ T_CHENILLARD T_ACTIVE
;

: CHENILLARD
    0 DUP DUP SYNC_PORT_E
    PRG_PORT_D_H PRG_PORT_D_B 3 SYNC_PORT_D
    49152 T_CHENILLARD DUP >R T_AJOUTE 10 R> T_ACTIVE
;

: LANCE
    [ HERE LITERAL ] >HERE
    CHENILLARD
;

The instruction “LANCE” makes it possible to launch program “CHENILLARD” to the starting of the microcontroler.

If you discover an abnormality, please indicate it to me by sending a message with the maximum of details and especially the procedure allowing to put in evidence problem and send to the mailing list.