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
MiniPOV 1 question about RA0 >> GND
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
-
- Posts: 12151
- Joined: Thu Apr 06, 2006 4:21 pm
Re: MiniPOV 1 question about RA0 >> GND
it doesnt
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: MiniPOV 1 question about RA0 >> GND
The 16F684 has an ADC that is enabled by default. It must be disabled to use PORTA for digital IO.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.
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
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
-
- Posts: 11
- Joined: Tue Apr 07, 2009 11:09 am
Re: MiniPOV 1 question about RA0 >> GND
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
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
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: MiniPOV 1 question about RA0 >> GND
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.
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.
-
- Posts: 11
- Joined: Tue Apr 07, 2009 11:09 am
Re: MiniPOV 1 question about RA0 >> GND
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
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
- opossum
- Posts: 636
- Joined: Fri Oct 26, 2007 12:42 am
Re: MiniPOV 1 question about RA0 >> GND
Make sure the proper PIC is selected in the file and in MPLAB.
Make sure IMAGESIZE is correct.
Code: Select all
title "MiniPOV"
LIST P=16F648, F=INHX8M
#include <p16f648.inc>
-
- Posts: 11
- Joined: Tue Apr 07, 2009 11:09 am
Re: MiniPOV 1 question about RA0 >> GND
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
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
Please be positive and constructive with your questions and comments.