Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Calling all programming heads

Status
Not open for further replies.
The project you mentioned does not provide the listing.

"Hex file for PIC12F629 is not available and is not for sale"

I don't know why the project is on the web if it cannot be duplicated.


For a starter you are better off programming in assembly language as you only need to learn the 35 instructions.

-very true, but im not going to duplicate it I want to take out the ir stuff and have the keypad controll the dimming

-Why is assembly better? I thought that was lower level? and if I should use assembly what is the best complier to use? Do you have a aim? I dont want to piss off the mods
 
Assembly is the "lowest level". It comes aligned to "machine code" - the instructions that are instantly understood by the micro.

The only reason I prefer machine code is for easy fault-finding.

If you have a sub-routine that doesn't work, you know the fault lies in your code.
Your project just requires 6 separate sub-routines plus some delays.

These can all the created separately and tested separately and then combined.

If you want to use a higher-level language, you will have to learn all the in’s and out’s of the language.

With "machine code" you can “cut-and-paste” already written sub-routines.

It’s up to you.
 
Assembly is the "lowest level". It comes aligned to "machine code" - the instructions that are instantly understood by the micro.

The only reason I prefer machine code is for easy fault-finding.

If you have a sub-routine that doesn't work, you know the fault lies in your code.
Your project just requires 6 separate sub-routines plus some delays.

These can all the created separately and tested separately and then combined.

If you want to use a higher-level language, you will have to learn all the in’s and out’s of the language.


With "machine code" you can “cut-and-paste” already written sub-routines.

It’s up to you.

I see your point where I find some already written sub-rountines or sample code to at least get started? Also when you say sub rountines is that like loops?
 
Each little thing you do is put into a sub-routine.
One subroutine will be a delay another subroutine will scan the keyboard, another subroutine will detect the key-value and carry out the required operation.
Another sub-routine will detect another key-value and carry out the appropriate operation.

This is the way you build up the program.
But first you will want to connect a LED to the chip and turn it on then turn it on an off. This will let you know how long the delay sub-routine has to be to get the effect.

Don't forget the micro is carrying out instructions at 1,000,000 per second and it doesn’t stop, so you have to make sub-routines that can carry out a task and put the result somewhere where it can be located by another sub-routine.
You have to learn about things like debounce, as the micro will detect the key-press very quickly and go away and do something else. When it comes back, it must know if the key is the same as previously or if your finger has been removed and replaced.
You cannot expect to learn all these things in a week. It will take months. That’s why a large organisation knows the program is worth $5,000. They couldn’t get it for less.
 
interesting Im going to do some reading in to programming in assembly this weekend and start something by monday hopefully i can have some code to show you and get your guidance

thanks collin, oh btw you still haven't recommended me a assembly compiler
 
3v0 wrote:


The microchip PICkit3 is out and they are selling off the stock of PICkit2's for $30. Microchip makes sure the software is up to date, it works with MPLAB, and it is inexpensive.
 
I already planned on using a PIC12C508

You want a Flash chip. It has an F in its part number. I like the 16F877A it has lots of pins and resources. It is out of date but still nice. I am told the 16F887 is a more modern version. Both should be under 10 bucks. The 18F series is more powerful and not much more expensive. Microchip has a free C compiler for the 18F series. If you use the 16F I would use the free version of BoostC, but it has a 2 k code limit. Plan to devote quite a few weeks to learning enough to do this project. You will need to start by flashing an LED. You will also need a breadboard...... Read some of the tutorials.
 
Assembly is the "lowest level". It comes aligned to "machine code" - the instructions that are instantly understood by the micro.

The only reason I prefer machine code is for easy fault-finding.

hi,
Assembler isnt machine coding.

Machine code was written and entered byte by byte in hex format by hand, way back in the 'good old days' before assemblers were available.

Nostalgia time again Nigel.

Assembler is effectively a low level language.

Whatever language you write in,
the instructions that are instantly understood by the micro.
 
I'll add my 2c worth,

Forget the 12c509, use something like the 12F675 or 12F683.
Look at assembly and boostC, if you don't know either then the learning curve is probably the same in both cases.
Just have a go and when you get stuck, just ask.

Mike.
 
Mr.K I's not that hard to make you a dimmer but you wouldn't have any fun doing it. There all kind of code on the net for just about any thing you want to make. If you started your code people would help you. Here is some good site's to read.
1. Gooligum Electronics
2.
3. mikroElektronika : books : PIC microcontrollers
4. **broken link removed**
5.
Hope this helps I like the first two the best.
 
Last edited:
Mr.K If you would post what your trying to do here and stop Pm me. I'll do my best to help
you with it. Now
1. If you want to make a dimmer post the circuit or a link to it
2. If your dimmer is to use something like a sony remote you can use the 12F675
3. If it is to have a key pad then you need a bigger chip because of the key pad now you can use a 16f628a lot's of code that you can look at a learn by. Me my self I would use a 18f1230 I like basic and Assembly don't do much in C the 18F you can use swordfish basic
4. If you want help the form is where it at now I -know you think people are not willing to help that's not so they wouldn't be on here.

Post your code or a link to it here something like this
Code:
 LIST p=16F628  
 include "P16F628.inc" 
 ERRORLEVEL 0, -302 ;suppress bank selection messages
 __config 0x3D18
 
  cblock 0x20   ;start of general purpose registers
   count   ;used in looping routines
   count1   ;used in delay routine
   counta   ;used in delay routine
   countb   ;used in delay routine
   tmp1   ;temporary storage
   tmp2
   key   ;which key was pressed
   rows   ;counter for number of rows
   code1   ;registers for secret code
   code2
   code3
   code4
   key1   ;registers for keyed attempts
   key2
   key3
   key4
  endc
Now down load the circuit for the keypad add your pic and dimmer control to it and let's get started pick'n
 

Attachments

  • keypada.PNG
    keypada.PNG
    61.6 KB · Views: 215
Last edited:
I think I saw a post somewhere on this site about a key pad input lock controller, like what you are talking about except it switches a pin on for a few seconds to operate the lock motor. Taking a look at that would be a good start.
 
Ok Mr.K take a look at this and lets see if we can make it work
 

Attachments

  • dimmer.PNG
    dimmer.PNG
    10 KB · Views: 286
Last edited:
Put some pullups on a keyboard row. Keeps you from shorting outputs when you're scanning and someone presses more than one button at a time.
 
I wasn't done I was just trying to help him out I was going to put 3 10k on it and when I get time I'll add the part value.
 
Last edited:
Mr.K If you would post what your trying to do here and stop Pm me. I'll do my best to help
you with it. Now
1. If you want to make a dimmer post the circuit or a link to it
2. If your dimmer is to use something like a sony remote you can use the 12F675
3. If it is to have a key pad then you need a bigger chip because of the key pad now you can use a 16f628a lot's of code that you can look at a learn by. Me my self I would use a 18f1230 I like basic and Assembly don't do much in C the 18F you can use swordfish basic
4. If you want help the form is where it at now I -know you think people are not willing to help that's not so they wouldn't be on here.

Post your code or a link to it here something like this
Code:
 LIST p=16F628  
 include "P16F628.inc" 
 ERRORLEVEL 0, -302 ;suppress bank selection messages
 __config 0x3D18
 
  cblock 0x20   ;start of general purpose registers
   count   ;used in looping routines
   count1   ;used in delay routine
   counta   ;used in delay routine
   countb   ;used in delay routine
   tmp1   ;temporary storage
   tmp2
   key   ;which key was pressed
   rows   ;counter for number of rows
   code1   ;registers for secret code
   code2
   code3
   code4
   key1   ;registers for keyed attempts
   key2
   key3
   key4
  endc
Now down load the circuit for the keypad add your pic and dimmer control to it and let's get started pick'n

Sure :D like I mentioned in the pm, I want to make a modification to this hobby project

**broken link removed**

-My plan is to take out the IR stuff because it's controlled by IR and modify it. My Goal is to have the light dimmer be controlled by a 3x4 keypad. I have already order the parts from the schematic above minus the chip and the IR stuff. Here is how I want the chip to tell the keypad how to operate

When power is first turned on press “*” and enter a four digit default code; such as, “0000”.

-The light will begin to function.

- To change the code press “#” input the old code followed with a new four digit code sequence.

- New code sequence is accepted and must be used to allow the light to
function.
- Increasing brightness of the light will be controlled by pressing “2”.

-Decreasing brightness of the light will be controlled by pressing “8”

- After 30 seconds the user can not change the brightness with the “2” or “8” key. The selected code sequence must be re-entered.

-When the power goes off the default code will be set back to 0000
 
Last edited:
I like the schematic B! However I don't know which circuit better suites what im trying to do. Take a look at the **broken link removed** Im making the modification too and tell me what you think
 
Last edited:
It's more or less the same I just added A keypad
 
Last edited:
Status
Not open for further replies.

Latest threads

Back
Top