gnupic: stumped with simple led/button circuit


Previous by date: 28 Feb 2005 22:08:20 +0000 Re: [gnupic] Bug in GPAL 0.13.0 with functions, Andrew de Quincey
Next by date: 28 Feb 2005 22:08:20 +0000 Re: [gnupic] stumped with simple led/button circuit, Greg Hill
Previous in thread:
Next in thread:

Subject: stumped with simple led/button circuit
From: Tsu Do Nimh ####@####.####
Date: 28 Feb 2005 22:08:20 +0000
Message-Id: <cd4a1628050228140723f6fce2@mail.gmail.com>

Hi,

My first time posting.

I have, to test my setup, put together a simple circuit w/p16f877a,
20MHz crystal, button on PORTA,0, and led on PORTB,0.  I've compiled
assembler code to this target that copies the PORTA input register
(button) to the PORTB output register.

I checked all the voltages and connections, tried (success) shorting
the led cathode to ground.  I attached an oscilloscope lead to the
crystal to verify it is ticking ok.

But the button doesn't work.  After looking at the hardware, I assume
the problem is somewhere in the programming of the chip.

I'm using a PS+ and the picp programmer to load the program. 
Disassembling the .hex file results in:

=8<-------
000000:  1406  bsf      0x6, 0
000001:  1683  bsf      0x3, 0x5
000002:  1006  bcf      0x6, 0
000003:  1283  bcf      0x3, 0x5
000004:  0805  movf     0x5, w
000005:  0086  movwf    0x6
000006:  2804  goto     0x4
002007:  3f32  addlw    0x32
=8<-------

After loading the corresponding .hex code (gen'td using 'gpasm -o
ledon.hex ledon.asm'), and disassembling a dump from the chip using
picp/gpdasm, the code looks like:

=8<-------
000000:  0000  nop
000001:  1402  bsf      0x2, 0
000002:  1002  bcf      0x2, 0
000003:  1002  bcf      0x2, 0
000004:  0001  dw       0x1  ;unknown opcode
000005:  0004  dw       0x4  ;unknown opcode
000006:  0086  movwf    0x6
000007:  2805  goto     0x5
=8<-------

Can anyone provide insight as to why I'm getting this different code
out, or how I might look somewhere else for the source of the problem?

Thanks for your help, in advance.

Yours,

Tsu Do Nimh

Previous by date: 28 Feb 2005 22:08:20 +0000 Re: [gnupic] Bug in GPAL 0.13.0 with functions, Andrew de Quincey
Next by date: 28 Feb 2005 22:08:20 +0000 Re: [gnupic] stumped with simple led/button circuit, Greg Hill
Previous in thread:
Next in thread:


Powered by ezmlm-browse 0.20.