Maker Pro
Maker Pro

What's wrong?

Hi all,
I'm really losing my mind now, been fighting with this for 8 days
now, I give up. I hope you can tell me what's wrong in my setup. :(

I self made a PIC18F8720 development board, and it seems to work,
because I can program the chip with no problems.

I'm using 100 nF SMD capacitors near every Vdd (including AVdd),
and an integrated clock oscillator. It's a 24 MHz CMOS part by
Epson.

I wrote a simple test program which is supposed to set all ports
to output (via the TRISx registers), and then put all of them to
the "HIGH" logic level (via the PORTx registers).

This is my code, as shown by IC-Prog:
0000: D00F 0000 0000 0000 0000 0000 0000 0000
0008: 0000 0000 0000 0000 0000 0000 0000 0000
0010: 0000 0E00 6E92 6E93 6E94 6E95 6E96 6E97
0018: 6E98 6E99 6E9A 0000 0000 0000 0000 0000
0020: 0EFF 6E80 6E81 6E82 6E83 6E84 6E85 6E86
0028: 6E87 6E88 0000 0000 0000 0000 0000 0000
0030: D7DE 0000 0000 0000 0000 0000 0000 0000

And this is the configuration:
Config1 = 2500
Config2 = 000F
Config3 = 0080
Config4 = 0081
Config5 = C0FF
Config6 = E0FF
Config7 = 40FF
ID Value = 0123456789ABCDEF

Is there anything wrong in my machine code (for this quick test
I don't want to nor I think I need to install MP-Lab.. I tried
it and hated it, I will write my own source level debugger and
assembler and release it to the PD after I'm finished).

Is the reset vector ok? It's supposed to be a BRA to 0010, where
it will meet a NOP (no reason in particular) and then the value
00 will be moved to W, which in turn will be moved to all the
TRISx registers. Then W will be loaded with FF, which will be
copied to all the PORTx registers. Finally (through some NOPs,
again, just to leave some space for inserting other code for
experiments) there's supposed to be a final BRA back to 0010.
Addresses don't represent bytes, but instruction words.

I know it's tedious to go through machine code.. but if you're
kind enough, and if the code or the configuration is wrong, please,
can you point me to the errors?

Or, in alternative, could some kind soul post a small .HEX file
with a demo program that just turns some port pins ON and some
others OFF, just to see if my problem lies in my hardware or in
my code?

I hope to get your valuable help.. I really don't know what to
experiment else.

Kindest regards,
Mike Forrest
 
W

Willem

Jan 1, 1970
0
Hi all,
I'm really losing my mind now, been fighting with this for 8 days
now, I give up. I hope you can tell me what's wrong in my setup. :(

No idea about the PIC thing but your use of the [email protected] e-mail
adres is wrong.... The domain actually exists and e-mail address harversters
don't check for this kind of problem. Better use something like
[email protected].

Willem
 
V

vic

Jan 1, 1970
0
Hi all,
I'm really losing my mind now, been fighting with this for 8 days
now, I give up. I hope you can tell me what's wrong in my setup. :(

If I was programming in raw machine code, i'd be losing my mind too ...

You must have a really high opinion of us if you expect us to read and
program raw machine code directly.

The instruction at 0x00 is a bra 0x20, not bra 0x10. I didn't bother to
check the other ones (seem ok) but it should be the problem since TRISx
registers reset values are 0xFF.
Is there anything wrong in my machine code (for this quick test
I don't want to nor I think I need to install MP-Lab.. I tried
it and hated it, I will write my own source level debugger and
assembler and release it to the PD after I'm finished).

Don't reinvent the wheel ... you'll lose lots of time doing this. MPLAB
is quite a good tool, it includes several features like a simulator
which are quite useful.
Kindest regards,
Mike Forrest

regards,
vic
 
J

Jeffrey Turner

Jan 1, 1970
0
Hi all,
I'm really losing my mind now, been fighting with this for 8 days
now, I give up. I hope you can tell me what's wrong in my setup. :(

I self made a PIC18F8720 development board, and it seems to work,
because I can program the chip with no problems.

I'm using 100 nF SMD capacitors near every Vdd (including AVdd),
and an integrated clock oscillator. It's a 24 MHz CMOS part by
Epson.

I wrote a simple test program which is supposed to set all ports
to output (via the TRISx registers), and then put all of them to
the "HIGH" logic level (via the PORTx registers).

This is my code, as shown by IC-Prog:
0000: D00F 0000 0000 0000 0000 0000 0000 0000
0008: 0000 0000 0000 0000 0000 0000 0000 0000
0010: 0000 0E00 6E92 6E93 6E94 6E95 6E96 6E97
0018: 6E98 6E99 6E9A 0000 0000 0000 0000 0000
0020: 0EFF 6E80 6E81 6E82 6E83 6E84 6E85 6E86
0028: 6E87 6E88 0000 0000 0000 0000 0000 0000
0030: D7DE 0000 0000 0000 0000 0000 0000 0000

And this is the configuration:
Config1 = 2500
Config2 = 000F
Config3 = 0080
Config4 = 0081
Config5 = C0FF
Config6 = E0FF
Config7 = 40FF
ID Value = 0123456789ABCDEF

Is there anything wrong in my machine code (for this quick test
I don't want to nor I think I need to install MP-Lab.. I tried
it and hated it, I will write my own source level debugger and
assembler and release it to the PD after I'm finished).

Is the reset vector ok? It's supposed to be a BRA to 0010,

Yes, correct. (D00F = BRA 0x00F)
where
it will meet a NOP (no reason in particular)

Correct (0000)
and then the value
00 will be moved to W,

Correct (0E00 = MOVLW 0x00)
which in turn will be moved to all the
TRISx registers.

Correct (6E92...6E9A)
Actually, I'm looking at the PIC18C Reference Manual and it only lists
0x92 to 0x96 as TRISx registers, but I'll assume your particular
processor implements 0x97 to 0x9A. Those addresses are otherwise
unused, so there's no down side. :)
Then W will be loaded with FF,

Correct (0EFF = MOVLW 0xFF)
which will be
copied to all the PORTx registers.

6E80..6E88

Again, the general manual only shows PORTA thru PORTE (at 0x80 to
0x84) but I'll make a parallel assumption with the parallel lack of
down side.
Finally (through some NOPs,
again, just to leave some space for inserting other code for
experiments) there's supposed to be a final BRA back to 0010.

Yes (D7DE = BRA -0x021)
Addresses don't represent bytes, but instruction words.

I know it's tedious to go through machine code.. but if you're
kind enough, and if the code or the configuration is wrong, please,
can you point me to the errors?

Or, in alternative, could some kind soul post a small .HEX file
with a demo program that just turns some port pins ON and some
others OFF, just to see if my problem lies in my hardware or in
my code?

I hope to get your valuable help.. I really don't know what to
experiment else.

I haven't checked your configuration yet, but the code looks fine.

--Jeff
 
S

Sam B.

Jan 1, 1970
0
[email protected] wrote in message
I'm not a PIC expert, but I'll offer my two cents worth...
Hi all,
I'm really losing my mind now, been fighting with this for 8 days
now, I give up. I hope you can tell me what's wrong in my setup. :(

I self made a PIC18F8720 development board, and it seems to work,
because I can program the chip with no problems.

I suppose that you can also read back what you wrote to the chip,
correct?
I'm using 100 nF SMD capacitors near every Vdd (including AVdd),
and an integrated clock oscillator. It's a 24 MHz CMOS part by
Epson.

I wrote a simple test program which is supposed to set all ports
to output (via the TRISx registers), and then put all of them to
the "HIGH" logic level (via the PORTx registers).

Some chips will have some sort of extra global port enable that needs
to be set before the port pins can be used at all.
This is my code, as shown by IC-Prog:
0000: D00F 0000 0000 0000 0000 0000 0000 0000
0008: 0000 0000 0000 0000 0000 0000 0000 0000
0010: 0000 0E00 6E92 6E93 6E94 6E95 6E96 6E97
0018: 6E98 6E99 6E9A 0000 0000 0000 0000 0000
0020: 0EFF 6E80 6E81 6E82 6E83 6E84 6E85 6E86
0028: 6E87 6E88 0000 0000 0000 0000 0000 0000
0030: D7DE 0000 0000 0000 0000 0000 0000 0000

And this is the configuration:
Config1 = 2500
Config2 = 000F
Config3 = 0080
Config4 = 0081
Config5 = C0FF
Config6 = E0FF
Config7 = 40FF
ID Value = 0123456789ABCDEF

Is there anything wrong in my machine code (for this quick test
I don't want to nor I think I need to install MP-Lab.. I tried
it and hated it, I will write my own source level debugger and
assembler and release it to the PD after I'm finished).

Is the reset vector ok? It's supposed to be a BRA to 0010, where
it will meet a NOP (no reason in particular) and then the value
00 will be moved to W, which in turn will be moved to all the
TRISx registers. Then W will be loaded with FF, which will be
copied to all the PORTx registers. Finally (through some NOPs,
again, just to leave some space for inserting other code for
experiments) there's supposed to be a final BRA back to 0010.
Addresses don't represent bytes, but instruction words.

I know it's tedious to go through machine code.. but if you're
kind enough, and if the code or the configuration is wrong, please,
can you point me to the errors?

Or, in alternative, could some kind soul post a small .HEX file
with a demo program that just turns some port pins ON and some
others OFF, just to see if my problem lies in my hardware or in
my code?

I hope to get your valuable help.. I really don't know what to
experiment else.

Kindest regards,
Mike Forrest

Don't give up so easily... I built my own eval board for the TI
'5402 DSP chip some time ago. I remember that it took me 1-2 weeks
to figure out how to properly use the serial port, as a beginning
step. In the end, it turned out to be a piddling problem of the CPU
just writing the most and least significant words in inverted (wrong)
fashion to the serial port TX registers. Seems the documentation
wasn't immediately obvious in that regard. That first problem is
always the hardest to deal with, but it gets easier after that.

Sam B.
 
Top