I am working with an ATmega128 chip that has 64KB external memory. I would like to be able to configure the program to use some of this memory. Any ideas on how to access that memory and use it? Also, I want to be able to access only one pin instead of the whole port. I have used DDRB to set the direction of a port and PORTx to set a port. I see there is a definition for PINx, and there are some #defines in the following manner – #define PINB7 7 If I have PINB = 0 in my code, then I come up with no errors, but this does not specify a pin. If I have PINB7 in my code, then I come up with error messages. How do I specify which pin I want? Thanks for any and all help. It is always much appreciated. - Josh
These are really questions for the compiler and linker, rather than FreeRTOS. You don’t say which compiler you are using. If you want to use the external memory you will have to enable the memory bus in the startup code, set the wait states (if any) and set the linker script so that it knows about the memory and what to put there (eg read only for program code, read/write for RAM etc.). How all this is done depends on the compiler. If you are using GCC then take a look at the linker script and boot code to see what it is doing now. It looks like the PINB7 definition is intended for use with the PORTx definition. As in PORTx &= ~PINB7 to clear the bit, and PORTX |= PINB7 to set the bit. I don’t know enough about the AVR to know if there instructions to set and clear specific bits, rather than using byte access in this way. I suspect there will be.
I am using GCC with the WinAVR environment. Thanks for the help. After I wrote this, I was told by somebody else that my memory question was probably more related to WinAVR.
Copyright (C) Amazon Web Services, Inc. or its affiliates. All rights reserved.