This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

code examples for init files

Hello,

there's an option in keil uvision under "options for target >> utilities" which is called init file.

Is it possible to write an short code, where I'm able to set one pin to gnd bevor I upload some code by jtag?

Is there a code example for such things?

best wishes
daniel

Parents Reply Children
  • thanks for the links.

    but I'm not able to find a suitable function to define one pin from the processor as output and write 0 to this pin.

    I think I can use _WWORD to write 0 to this specific address - but which command do I have to use to define this pin as output?

    best regards
    daniel

  • Have you read any datasheet for your processor?

    Everything in this world does not require a command, so don't spend too much time looking for commands.

    Most processors allow access to processor pins (and their configuration) by use of special variables. The address of these variables is clearly documented in the processor datasheets. The name of them - and how to use them - is quite clearly documented in the application notes available on the chip manufacturers homepage and in the application notes and sample programs available from Keil.

    How many of the app notes and sample programs have you looked at?

  • I know who I can set one pin of my controller to a 0 or 1 - the only thing I don't know is how I have to implement this code into the init file.

    e.g. for my atmel controller:

    AT91C_BASE_PIOB->PIO_SODR |= AT91C_PIO_PB15;
    

    AT91C_BASE_PIOB->PIO_CODR |= AT91C_PIO_PB15;
    

    that's the code to set one pin of my controller to 0 or 1.

    my init file at the moment:

    // Switching from Slow Clock to Main Oscillator for faster Download
    _WDWORD(0xFFFFFC20, 0x00000601);        // PMC_MOR: Enable Main Oscillator
    _sleep_(10);                            // Wait for stable Main Oscillator
    

    How do I have to write this code in the init file?

    best regards
    daniel