striegld
Joined: 07 Jul 2009 Posts: 1
|
PIC18F8722 port problem |
Posted: Tue Jul 07, 2009 2:02 pm |
|
|
Hello,
I've a problem with my new PIC18F8722 board. This board has a parallel bus implemented on port J. If i try to write to port J in my main routine the levels on the port J pins are ok. So now my problem: If i take the same code but packed in a function with a int8 parameter value, the ouput of port j is anything but not the parameter value. fast_io on port j is enabled, uC-mode is selected (control ports of external memory on port j). The lst-file seems to be ok, the assembler code looks like it should be.
I previously worked on a PIC16F887 and the code worked fine. Is there anything to be aware of when migrating to a PIC18/PCH?
Thanks for your replies!
Code: |
// -- fuses ---------------
#FUSES NOWDT //No Watch Dog Timer
#FUSES WDT128 //Watch Dog Timer uses 1:128 Postscale
#FUSES H4 //High speed osc with HW enabled 4X PLL
#FUSES NOPROTECT //Code not protected from reading
#FUSES IESO //Internal External Switch Over mode enabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES BORV25 //Brownout reset at 2.5V
#FUSES NOPUT //No Power Up Timer
#FUSES NOCPD //No EE protection
#FUSES STVREN //Stack full/underflow will cause reset
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOLVP //No low voltage prgming, B3(PIC16) or B5(PIC18) used for I/O
#FUSES NOWRT //Program memory not write protected
#FUSES NOCPB //No Boot Block code protection
#FUSES NOEBTRB //Boot block not protected from table reads
#FUSES NOEBTR //Memory not protected from table reads
#FUSES NOWRTD //Data EEPROM not write protected
#FUSES NOWRTC //configuration not registers write protected
#FUSES NOWRTB //Boot block not write protected
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES NOLPT1OSC //Timer1 configured for higher power operation
#FUSES NOMCLR //Master Clear pin used for I/O
#FUSES XINST //Extended set extension and Indexed Addressing mode enabled
#FUSES MCU //Microcontroller Mode
#FUSES WAIT //Wait selections for Table Reads and Table Writes
#FUSES BW16 //16-bit external bus mode
#FUSES ABW20 //20-bit Address bus
#FUSES ECCPE //Enhanced CCP PWM outpts multiplexed with RE6 thorugh RE3
#FUSES CCP2E7 //CCP2 input/output multiplexed with RE7
// -- fast io config ---------------
#use fast_io(a)
#use fast_io(b)
#use fast_io(c)
#use fast_io(d)
#use fast_io(e)
#use fast_io(f)
#use fast_io(g)
#use fast_io(h)
#use fast_io(j)
// -- I/O-pin defines ---------------
//peripheral bus
#define Ph_E PIN_H0
#define Ph_RW PIN_H1
#define Ph_RS PIN_H2
// -- section of call in main ------------------
int8 i=0;
i=0x03;
pbus_write(i);
// -- pbus_write(value): writes value to parallel bus ------------------
void pbus_write(int8 val){
output_j(val);
output_bit(Ph_E,1);
#ASM
//NOP //timing also ok without delay
//NOP
//NOP
#ENDASM
output_bit(Ph_E,0);
}
|
|
|