need help with pic programming

panic mode

Joined Oct 10, 2011
2,761
it works but there still may be problems. soldering is not clean and i see wire going over pad that belongs to different circuit. this is very risky - you may have project quit working (or maybe damage something) even if you sneeze. also where are the 330 ohm resistors? i see 33 Ohm, which means pic outputs driving transistors are overloaded (if the pic outputs could supply it, base current would be some 120mA).
 

Thread Starter

cinciredsfan10

Joined Apr 28, 2012
21
well this was only my first build so for it to light up is a success to me no matter how sloppy the work is. As for the resistors, I used what i had and so far it is working without anything heating up or shorting out.I now have a new question. I am trying to create my own patterns but i have no idea how to program. the original guy who create the instructable created a program that writes code for patterns. I created a pattern and inserted it into the asm file and when i went to build it the build failed. I think his program is for writing on pic16f690 or something like that. is there any easy explanations on how to create my own paterns or do i need to learn a lot more about the pic language before i can create my own? some of the errors were:
Error[126] C:\USERS\OWNER\DOCUMENTS\LED CUBE\LED2.ASM 22 : Argument out of range (0405 not between 0000 and 03FF)
Message[302] C:\USERS\OWNER\DOCUMENTS\LED CUBE\LED2.ASM 1161 : Register in operand not in bank 0. Ensure that bank bits are correct.
 

Markd77

Joined Sep 7, 2009
2,806
The first error means the program memory is full, if you replace a subroutine (like "cubefill") with something with the same or less instructions you should be fine.
If you find an instruction like "org 0x400" in the generated code, remove it, that might be why the error is happening at line 22.
That particular message can usually be ignored.
Not sure the best place to get stripboard, but it will be pretty cheap at most of the major electronics suppliers.
 
Last edited:

Thread Starter

cinciredsfan10

Joined Apr 28, 2012
21
The first error means the program memory is full, if you replace a subroutine (like "cubefill") with something with the same or less instructions you should be fine.
If you find an instruction like "org 0x400" in the generated code, remove it, that might be why the error is happening at line 22.
That particular message can usually be ignored.
Not sure the best place to get stripboard, but it will be pretty cheap at most of the major electronics suppliers.
You did it again :) Thanks!! i removed one of the longer programs and inserted my new one and worked like a charm. So this pic has a relatively low memory i guess? other people were talking about using the 690 pic and it has much more memory. if i got one of those would the same progam still load onto it and run or are some of the ports different. The exact model was PIC16F690
 

Markd77

Joined Sep 7, 2009
2,806
Yes, the 690 has four times the program memory of the 84A. It's slightly different code, but it's on the page you linked to.
There's actually a way to squeeze in about double the current size of the patterns. It's probably on the advanced side for a first program, but if you are prepared to do a bit of reading and getting to know MPLab and it's simulator, we can probably help with the tricky bits.
It's not going to be an overnight project, probably a couple of weeks.
If you want to, have a quick look through the instructions section of the datasheet, get MPLab SIM working and follow the flow of the current program, then have a look at AN556 from the Microchip site, you would be using table reads, but it gets tricky because of the pages of program memory.
Alternatively there are some decent tutorials for the 84A like maybe this one:
http://www.mstracey.btinternet.co.uk/pictutorial/progtut1.htm
This one is good but is for slightly simpler PICs, but the code will work with minor modifications.
http://www.gooligum.com.au/tut_baseline.html
There's some good links here:
http://forum.allaboutcircuits.com/showthread.php?t=44852
 

Thread Starter

cinciredsfan10

Joined Apr 28, 2012
21
Is there a way i could switch the current code that uses a 4mHz crystal to 16mHz crystal? I came across a bunch of 16mHz crystals and dont want to buy any more 4's. Thanks
 

BMorse

Joined Sep 26, 2009
2,675
Is there a way i could switch the current code that uses a 4mHz crystal to 16mHz crystal? I came across a bunch of 16mHz crystals and dont want to buy any more 4's. Thanks

No you can not, unless your pic uses a 16mhz crystal, as I have seen, your pic is only a 4mhz one, you can get ones that are up to 20mhz, but then all your code will have to be tailored or the timing won't work with the 20mhz frequency....
 

Thread Starter

cinciredsfan10

Joined Apr 28, 2012
21
UPDATE: I recently got an arduino uno for school and took a few hours building the cube and circuit and programmed the arduino to run the cube from scratch. Had a lot of fun and it was much easier than using the pic microcontrollers. Check it out...

http://youtu.be/lxHC9B2fHjI
 

Thread Starter

cinciredsfan10

Joined Apr 28, 2012
21
I'm sure it was, considering all the hard work writing most of the code was already done for you and all you did was use other peoples work.... ;)
I meant as a whole using the arduino was a lot easier than the pic. I did all of the programming with the arduino and had zero issues. I had many problems just trying to get the pic to program. But yes i used someone else's code that was uploaded for that specific reason as i had never programmed before. Not sure what you were trying to accomplish with that post but congrats for looking like an ass. Just a beginner here having fun learning the technology. Thanks for the criticism.
 

BMorse

Joined Sep 26, 2009
2,675
I meant as a whole using the arduino was a lot easier than the pic. I did all of the programming with the arduino and had zero issues. I had many problems just trying to get the pic to program. But yes i used someone else's code that was uploaded for that specific reason as i had never programmed before. Not sure what you were trying to accomplish with that post but congrats for looking like an ass. Just a beginner here having fun learning the technology. Thanks for the criticism.
It was not meant as criticism.... I was just merely pointing out that arduino's are meant for people with no experience in programming, since most of the "real" work was already done by someone else (i.e. setting uC configurations, setting oscillator types, setting tris registers, etc....).
 

ErnieM

Joined Apr 24, 2011
8,377
Is there a way i could switch the current code that uses a 4mHz crystal to 16mHz crystal? I came across a bunch of 16mHz crystals and dont want to buy any more 4's. Thanks
The pic16f84ais good to go to 20MHz, and as 16 is less then 20 yes the chip will work.

Of course, any code delays must be reworked.
 
Top