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.

PIC 10F200 Project help

Status
Not open for further replies.

techdummy

New Member
I hv no knowledge of µcontrollers and wish to start off with 10F200. I want to write a simple program for serially reading out data (previously) stored in ROM at the rate of about 50 KHz (or some such predefined period). This should happen after a switch is pressed, from a sleep or wait mode. Will appreciate detailed help. Thanx.
 
The 10F200 is a VERY limited chip. It has 256 words of ROM for program and 16 bytes of RAM. It can't do very much but as your description is so vague I have no idea if it can do what you want.

Mike.
 
I am told 10F200 is a simple chip for beginners. I need to simply serially read out some data stored in ROM. The data length may be about 100bits just for a trial. The reading must be done at about 50KHz (not critical but this will help me learn about controlled rate of output). The output should start after a switch is momentarily closed. That way, I can learn about I/O before going on to higher stuff. I have seen (in various forums) more complex programs used with 10F200 and so I think this program should comfortably fit in.
 
The 10F200 is a really bad chip to learn on. It is the smallest and cheapest there is and this makes it very limited and difficult to program.

You are still telling us what you think the solution to your problem is. Try telling us the problem and we may be able to help with a solution.

Mike.
 
techdummy:
As far as I know, the 10f200 or baseline chips cannot self write, so just how is ROM going to be outputted to a GPIO? I think you mean RAM. If you mean ROM, then a more capable chip that can self write is required. If you are stuck on the baseline chips, why not get a 12f509?, it will a little more forgiving to learn on.

The 50khz timing can be accomplished by a delay routine, PICLIST has an online delay calculator, or look to Gooligum for a tutorial(s).
 
I, personally, would recommend starting with a 16F chip, instead. It is a bit larger than the 10F and 12F chips, and in general is easier to learn on. I, too, am just getting started with micro-controllers, and my earliest programs (in ASM) were for a 16F84. I suggest you start there.
Best regards,
Der Strom
 
Base line chips are by know means the easiest to use. And on top of that there real easy to program wrong and lock the chip.
If you want a small chip go for the 12f683 or 12f675 much easer to use.
 
Guys, Thanx for the comments. Some points:

1. I have been checking out on the ROM. There appears enough PROM on 10f200 for storing 100 bits of data plus the requisite program to read it out at the rate (50KHz) planned by me.

2. The reason for choosing 10F200 is that I have already bought one and have made the artwork based upon app notes on the Net. So, I will stick to it presently. I can move onto next level chips once I gain confidence experimenting with µcontrollers.

3. Mark: the problem simply stated is: I will store the 100 bits of data at specific memory locations on the onboard ROM during programming. Then I will like to output this data at the rate of 50KHz when I press a momentary contact switch. I need the following help in doing this: program for implementing this and the way of programming the chip thru a Laptop. Hope this clarifies.
 
Looks like about 70 to 80 words of program memory to me (after adding a handful of initialization instructions). I attached a code snippet to give you some ideas (tx8bits is a macro that loads WREG and calls the send8bits sub').

Good luck on your project.

Regards, Mike

Code:
;
;  swnew  ___---___---___---___   sample active lo switches
;  swold  ____---___---___---__   switch state latch
;  swnew  ___-__-__-__-__-__-__   changes, press or release
;  swnew  ___-_____-_____-_____   filter out 'release' bits
;
mainLoop
        DelayCy(20*msecs)       ; 20-msec debounce interval
        comf    GPIO,W          ; sample active lo switches
        andlw   b'00000010'     ; on the GP1 pin
        xorwf   swold,W         ; changes, press or release
        xorwf   swold,F         ; update switch state latch
        andwf   swold,W         ; filter out 'release' bits
        skpnz                   ; new press? yes, skip, else
        goto    mainLoop        ; loop (wait for press)
;
;  on "new press", send 104 bits at a 50-KHz (20-usec) rate
;
task
        clrf    bitctr          ;
        tx8bits(b'00000000')    ; movlw xx & call send8bits
        tx8bits(b'00000001')    ;
        tx8bits(b'00000000')    ;
        tx8bits(b'00000001')    ;
        tx8bits(b'00000000')    ;
        tx8bits(b'00000001')    ;
        tx8bits(b'00000000')    ;
        tx8bits(b'00000001')    ;
        tx8bits(b'00000000')    ;
        tx8bits(b'00000001')    ;
        tx8bits(b'00000000')    ;
        tx8bits(b'00000001')    ;
        tx8bits(b'00000000')    ;
        goto    mainLoop        ;

send8bits
        movwf   work            ; save byte value
        bsf     bitctr,3        ; bitctr = 8
sendloop
        movlw   b'00000001'     ; assume a '1'
        btfss   work,0          ; is it '1'? yes, skip,else
        movlw   b'00000000'     ; reset to '0'
        movwf   GPIO            ; send bit out on GP0 pin
        DelayCy(20*usecs-14)    ; 20-usecs minus 13 cycles
        rrf     work,F          ; shift 'work' variable
        decf    bitctr,F        ; decrement bit counter
        skpnz                   ; done? no, skip, else
        return                  ; exit
        goto    $+1             ; burn off 2 cycles
        goto    $+1             ; burn off 2 cycles
        goto    sendloop        ; loop (send another bit)
;
 
Last edited:
Thanx Mike (& my apologies for messing up your name in my last post....!!). I will study the program and see where it lands me. I am sure it will take some time for me to do so since I need to check it out alongwith the instruction set for 10F200.
 
Hi tech',

I apologize if that code snippet is a bit beyond your current capabilities but at least you know that the project is feasible. The code basically implements isochronous timing (takes the same amount of time to execute each time) inside of the "task" section in order to send each bit out at precise 20-usec (50-KHz) intervals.

Cheerful rergards, Mike
 
Last edited:
Hi Mike

I have been trying to understad the code written by you and you are right: it is beyond me at present. May be you can help further in this. Firstly, u hv a program line "DelayCy (20*msecs)". I cannot find this command in the instruction set. Is this taken care of by the compiler/ interpreter and corresponding codes are auto-generated?

Also, lines 1 to 6 are marked with ";" which, I suppose, means they are only comments. But u use swold in the program (Line 11, etc). Do you have to shift the ";" in the lines 2 to 5 to after the "waveforms"? BTW, what do the waveforms signify?
 
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top