MiniPOV 1 question about RA0 >> GND

MiniPOV, MiniPOV2 and MiniPOV3

Moderators: adafruit_support_bill, adafruit

MiniPOV 1 question about RA0 >> GND

Postby SamuelAaronWard » Tue Apr 07, 2009 2:48 pm

In LadyAda's MiniPOV 1 project, the schematic shows RA0 being connected to GND through a normally open SPST switch. In her description of the project, she states that the button doesn't do anything yet.

I'm building a DIY version, and I need to make sure that this RA0 (pin 13) doesn't need to be connected to GND to activate the device. ...I haven't done any ASM programming in a long time (and wasn't very good at it when I did), so I cannot determine this from the code.

I need to spend some time on my C and ASM programming!

Thanks!
Aaron
User avatar
SamuelAaronWard
 
Posts: 11
Joined: Tue Apr 07, 2009 10:09 am
Location: Charleston, West Virginia, USA

Re: MiniPOV 1 question about RA0 >> GND

Postby adafruit » Tue Apr 07, 2009 3:49 pm

it doesnt
User avatar
adafruit
 
Posts: 10485
Joined: Thu Apr 06, 2006 3:21 pm
Location: nyc

Re: MiniPOV 1 question about RA0 >> GND

Postby oPossum » Tue Apr 07, 2009 4:56 pm

SamuelAaronWard wrote:4) Yes, my POV did light up upon programming, but only 5 LEDs are working so far. They are flashing, and it is obvious that the POV is almost working correctly. Yes, I checked my circuit.


The 16F684 has an ADC that is enabled by default. It must be disabled to use PORTA for digital IO.

Change this:
Code: Select all
Main
   CLRF  PORTA          ; drop all the port A lines low
   MOVLW 0x1            ; set_tris_a(0b000001)
   BSF   0x03,RP0
   MOVWF TRISA
   BCF   0x03,RP0


to this:
Code: Select all
Main
   CLRF  PORTA          ; drop all the port A lines low
   MOVLW 0x1            ; set_tris_a(0b000001)
   BSF   STATUS,RP0    ; Select high bank registers
   MOVWF TRISA
   CLRF   ANSEL        ; Use PORTA for digital IO, not analog
   BCF   STATUS,RP0    ; Back to low bank registers
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
User avatar
oPossum
 
Posts: 634
Joined: Thu Oct 25, 2007 11:42 pm
Location: Michigan, USA

Re: MiniPOV 1 question about RA0 >> GND

Postby SamuelAaronWard » Tue Apr 07, 2009 5:22 pm

Thanks for the reply, oPossum (and LadyAda). I understand what you're saying about disabling the ADC in order to use the PORTA pins, but I'm using LadyAda's code which I assume comes programmed in her POV kits (downloadable from her site). If this code is proven and works, do I really need to modify it? What I'm saying, is shouldn't it work already??? ...Or are you saying that the PIC16F630 (which LadyAda used) doesn't have the internal ADC that the PIC16F684 does have - and therefore the need to modify the code? If that's the case, then thank you so much - great catch! I sincerely appreciate you taking the time to let me know about this difference between PIC chips.

I'm new to PICs (only started about a month ago) and need all the help I can get.

By the way, do you know of a good primer to help me learn PIC ASM? I can't even work my way through the code on an elementary level because I don't know the opcodes or how they work. ...I did look up the list of opcodes on www.piclist.com, but the listing is for 12 bit PICs. Plus, I need a tutorial or something to show me one by one how to use each opcode. Any suggestions???

Thanks a bunch!

Aaron :)
User avatar
SamuelAaronWard
 
Posts: 11
Joined: Tue Apr 07, 2009 10:09 am
Location: Charleston, West Virginia, USA

Re: MiniPOV 1 question about RA0 >> GND

Postby oPossum » Tue Apr 07, 2009 5:48 pm

The 16F630 does not have an ADC, the 16F684 does. Code written for one PIC will usually require some changes to run on an other PIC with different peripherals.

Mid-Range Reference Manual - Everything you need to know about 14 bit instruction size PICs.

The PIC List or Microchip Forums are the best places to get expert PIC advice.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
User avatar
oPossum
 
Posts: 634
Joined: Thu Oct 25, 2007 11:42 pm
Location: Michigan, USA

Re: MiniPOV 1 question about RA0 >> GND

Postby SamuelAaronWard » Tue Apr 07, 2009 10:42 pm

Okay, LadyAda and oPossum, I've made some progress...

oPossum, I tried your code to disable the ADC, but it wouldn't compile - something about an unrecognized symbol "ANSEL". I believe that I would need to define / initialize ANSEL at the top of the program, but I'm not sure how to do that in ASM. However, by leaving the code the way it was, all I/O pins still seem to work as digital outputs anyway.

So I tried creating my name, "Aaron". When I would wave it back and forth, it was hard to read. Obviously, it was displaying my name backwards on the reverse stroke - overlapping the forward stroke and producing a jumbled mess. So I taped it to a blade on my ceiling fan! :) It seemed to work somewhat. Click this link to see a picture:

http://img8.imageshack.us/img8/9821/pov1.png

The first three letters appeared, but they were each slightly incorrect.

Any suggestions?

Thanks!

Aaron :)
User avatar
SamuelAaronWard
 
Posts: 11
Joined: Tue Apr 07, 2009 10:09 am
Location: Charleston, West Virginia, USA

Re: MiniPOV 1 question about RA0 >> GND

Postby oPossum » Tue Apr 07, 2009 11:17 pm

Make sure the proper PIC is selected in the file and in MPLAB.

Code: Select all
   title "MiniPOV"
   LIST   P=16F648, F=INHX8M
#include <p16f648.inc>



Make sure IMAGESIZE is correct.
I am the Possum, and I approve of this message. Sent from MacBook Wheel Sorry for my bad German.
User avatar
oPossum
 
Posts: 634
Joined: Thu Oct 25, 2007 11:42 pm
Location: Michigan, USA

Re: MiniPOV 1 question about RA0 >> GND

Postby SamuelAaronWard » Wed Apr 08, 2009 9:46 pm

Okay, oPossom, you were right again! :)

I changed the PIC designation and include statements to the PIC16F684 instead of the PIC16F630 as LadyAda originally used. I then downloaded the program to my POV, but there was no change.

Then I looked through the program for the IMAGESIZE variable, as you suggested. I had no idea what dimension the variable actually affected. It was set at 0x10 (16 in decimal). First I thought that might be the height (as in a POV with a column 16 LEDs high), so I changed it to 0x08 (8 in decimal) since my POV is only 8 LEDs high. That didn't change anything. (I'm assuming that you'd have to use a word instead of a byte to make a POV taller than 8 LEDs. Either that or modify the code to have the byte do the upper and lower 8 LEDs seperately.) ...Anyway, I then deduced that the IMAGESIZE controlled the width of the text displayed, which made sense since mine was displaying 16 columns (0x10) of my name - including spaces. So I went back and counted my columns and came up with 35 (including some spaces at the end). I changed the IMAGESIZE variable to 0x23 (35 in decimal), and it worked! Click the following link to see a picture:

http://img13.imageshack.us/img13/4826/pov2.png

There is still a problem (explained in text added to the picture in the link above) with some inverted rows. I'm going to fix that by rewiring my POV.

I'll post new pictures tomorrow after I fix it. I need to get some sleep now for work tomorrow.

Thanks for your help, oPossum! :)

Aaron
User avatar
SamuelAaronWard
 
Posts: 11
Joined: Tue Apr 07, 2009 10:09 am
Location: Charleston, West Virginia, USA


Return to MiniPOV

Who is online

Users browsing this forum: No registered users and 4 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [102]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]