using_pic18f4620
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
using_pic18f4620 [2006/07/09 08:37] – All it takes is one typo, and your code is stuffed ;) stryd_one | using_pic18f4620 [2011/11/18 12:14] (current) – removed spam lpdunwell | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | ====== Using the PIC18F4620 or PIC18F4520 ====== | ||
- | + | FIXME This is really outdated!!! | |
- | ====== Using the PIC18F4620 or PIC18F4520 ====== | + | |
- | ==== Note that there are some missing steps in this documentation ==== | + | |
- | I am making corrections. and will post them shortly.\\ | + | |
- | \\ | + | |
Historically, | Historically, | ||
Line 14: | Line 11: | ||
====== OS Layers ====== | ====== OS Layers ====== | ||
- | MIOS v1.9b or above is required. You will need to download the MIOS source from [[http:// | + | MIOS v1.9b or above is required. You will need to download the MIOS source from |
\\ | \\ | ||
The Bootloader and MIOS recompile steps which follow should not be necessary for most cases of '4620 use, as these components are now available precompiled and packaged in a zip file [[http:// | The Bootloader and MIOS recompile steps which follow should not be necessary for most cases of '4620 use, as these components are now available precompiled and packaged in a zip file [[http:// | ||
Line 48: | Line 45: | ||
\\ | \\ | ||
* Compile the project FIXME wiki link | * Compile the project FIXME wiki link | ||
+ | * also see: [[Compiling the MIDIbox source on Linux]] - using GPASM (Linux, Mac) instead of MPLAB (Windows) | ||
\\ | \\ | ||
* Upload the hex file with MIOS Studio FIXME wiki link | * Upload the hex file with MIOS Studio FIXME wiki link | ||
Line 96: | Line 94: | ||
If your application is C-based, then the following steps are required. Some are optional recommendations, | If your application is C-based, then the following steps are required. Some are optional recommendations, | ||
+ | |||
+ | == Note on compile errors == | ||
+ | |||
+ | When compiling your C-based application, | ||
+ | |||
+ | Linking project | ||
+ | warning: processor mismatch in " | ||
+ | |||
+ | This error is caused by SDCC compiling the application for the PIC18F452. Fortunately, | ||
==== Header and Library ==== | ==== Header and Library ==== | ||
Line 157: | Line 164: | ||
goto MIOS_HLP_Dec2BCD | goto MIOS_HLP_Dec2BCD | ||
</ | </ | ||
+ | |||
==== Linker Script ==== | ==== Linker Script ==== | ||
+ | |||
Modifications should be made to the linker script in order to take advantage of the additional capabilities of the 4620/ | Modifications should be made to the linker script in order to take advantage of the additional capabilities of the 4620/ | ||
Line 175: | Line 184: | ||
To | To | ||
CODEPAGE | CODEPAGE | ||
+ | |||
+ | |||
+ | If you are using a GLCD with your PIC18F4620 the GLCD Font of the MIOS will be overwritten by this change though, as it lies in the range of 0x7C00-0x7FFF. There are __two__ approaches to prevent this (also see forum thread http:// | ||
+ | |||
+ | * To leave out the Font space in the PIC´s code memory, change | ||
+ | |||
+ | | ||
+ | To | ||
+ | | ||
+ | | ||
+ | |||
+ | __**or**__ try this solution from TK: | ||
+ | |||
+ | * copy the mios_glcd_font.inc file from the MIOS release into your application directory, rename it to mios_glcd_font.asm | ||
+ | * add following code to the file header: | ||
+ | |||
+ | LIST P=PIC18F4620, | ||
+ | DEFAULT_FONT code | ||
+ | FONT_ENTRY MACRO width, height, x0, char_offset | ||
+ | dw ((height) << 8) | (width), ((char_offset) << 8) | (x0) | ||
+ | ENDM | ||
+ | |||
+ | |||
+ | * change the " | ||
+ | * add a " | ||
+ | * add the new .asm file to the MAKEFILE.SPEC (behind the MK_SET_OBJ statement) | ||
+ | * change the font pointer within the Init() routine: | ||
+ | |||
+ | void Init(void) | ||
+ | { | ||
+ | MIOS_GLCD_FontInit(0xfcfc); | ||
+ | } | ||
+ | |||
+ | * if you are working under MacOS or Linux, type "perl tools/ | ||
+ | |||
+ | The first approach has the advantage, that it isn't required to upload the font again and again with each program update. | ||
+ | The second approach that new fonts can be inserted into the project in a similar way. | ||
+ | Please see the forum article mentioned above on instructions how to use labels in combination with fonts. | ||
=== Add Databanks === | === Add Databanks === | ||
Line 208: | Line 255: | ||
\\ | \\ | ||
==Extended Bank Capacity== | ==Extended Bank Capacity== | ||
+ | |||
+ | __**Be Careful doing this!!**__ | ||
+ | This can do weird things like make variables always = 0 where the memory that variable is stored in, crosses boundaries of 256b blocks. Do not make banks any larger than required, and try to let them begin at round numbers (100, 200, 300,...). This still might not even work. - stryd_one | ||
+ | |||
The above change will enable SDCC to allocate the variables in your application to any of the specified banks above. The very observant among you may have noticed that these banks are 256 bits each.... So what happens if you want to use a variable which is greater than 256 bits in size, such as a large array, or string of characters? For this, you will need to create a bank of extended size, and you will need to direct your application to use that bank to store your large variable. | The above change will enable SDCC to allocate the variables in your application to any of the specified banks above. The very observant among you may have noticed that these banks are 256 bits each.... So what happens if you want to use a variable which is greater than 256 bits in size, such as a large array, or string of characters? For this, you will need to create a bank of extended size, and you will need to direct your application to use that bank to store your large variable. | ||
Line 253: | Line 304: | ||
\\ | \\ | ||
- | Or of course you could make the whole lot into one bank if you wanted to: | + | Or of course you could make the whole lot into one bank if you wanted to. This is NOT recommended though!: |
< | < | ||
DATABANK | DATABANK | ||
Line 286: | Line 337: | ||
You may create as many or as few sections as you require for your application. | You may create as many or as few sections as you require for your application. | ||
+ | |||
+ | |||
==== Application Code ==== | ==== Application Code ==== | ||
Line 297: | Line 350: | ||
< | < | ||
#pragma udata b512 MIDI_Table | #pragma udata b512 MIDI_Table | ||
- | unsigned | + | unsigned |
</ | </ | ||
- | Still reading? ;) | + | **It is recommended to avoid this wherever possible.** Allow the compiler to allocate the memory wherever possible! |
+ | |||
+ | Check [[http:// | ||
+ | |||
+ | \\ | ||
+ | * Compile the project FIXME wiki link | ||
+ | \\ | ||
+ | * Upload the hex file with MIOS Studio FIXME wiki link | ||
+ | \\ | ||
+ | \\ | ||
+ | \\ | ||
+ | Still reading? Shouldn' |
using_pic18f4620.1152434278.txt.gz · Last modified: 2006/10/15 09:35 (external edit)