Which chip do i use?


Closed Thread
Results 1 to 40 of 78

Hybrid View

  1. #1
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Darrel. I changed the design yesterday. I only need 16 PWM pins now. Someone made some circuits for me years ago that do exactly what im trying to do now and they work perfect. They only used smaller chips i think PIC16F84's. The person who made them lost the origional code in a format and i hardly ever see him online now. I guess he wasnt using your code though. Ive swapped to a PIC16F877A now. I hope that will do better.

    Im not sure about the frequency/resolution. I want a brightness control that is 0-100%. Here in the UK we have 50Hz which means 100 zero-crossings per second so i think for 100 brightness levels i should split each half cycle into 100. That should mean for a brightness level of 50% i wait 5ms before turning the output on. Im not sure how this would work though because 1% would be 100ns but isnt that faster than the chip can handle?
    Im sure im going about this bit the wrong way too.

    I checked the datasheet for PIC16F877A and it says it has USART So that should be ok.

    mackrackit. Its all becoming clear now. Im about to read through that thread now but i think i understand how it should work.

    Random thought. I can upload the .HEX file from one of the chips i have already doing this kind of thing with 8 PWM outputs. I dont know if anyone can do anything with it. Maby decompile to assembly?

  2. #2
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Just read through that thread and the PDF in it. I only understood some of it through. Im using triacs so i cant use bi-phase angle modulation. Phase angle modulation is what i was thinking of. Turn an output on at a set point durin the half cycle and let the triac turn itself off at the next zero-crossing. I dont think the drawbacks of that method will affect me because im not using LEDs. I got completely lost at BAM.

    The idea i had would work like this

    Code:
    interruptpoint: 'This is where it goes on interrupt from the zero-crossing pin RB0
    if brightness(0)=100 then
    high porta.0
    endif
    if brightness(1)=100 then
    high porta.1
    endif
    .........
    pause (100th of a cycle)
    if brightness(0)=99 then
    high porta.0
    endif
    ......
    'by now it should be right at the end of the half cycle
    'set the pins to low so the triacs dont all come back on in the next half cycle
    low porta.0
    low porta.1
    resume
    Obviously i wouldnt type out hundreds of if statements, i would use a loop instead but thats what i was thinking of. It looks a little slow though

    I know ive got to learn serial now without using serin2.
    Which interrupt method do i need? (or which one should i start learning?)

  3. #3
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Should I also guess that the serial is comming in at 250kbaud?
    There are 512 frames, at ~40hz.
    A.K.A. ... DMX

    .
    DT

  4. #4
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    I was going to use 9600n. Thats what everything else uses including the origional boxes my mate made

    EDIT: The plan wasnt to use these as DMX lights but how hard would that be? IVe got a DMX controller and i think its faster than anything ive done using the serial port (My DMX box is USB>DMX)
    Last edited by The Master; - 27th November 2007 at 07:03.

  5. #5
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Hehe. Ive had a quick google of DMX in PBP and it sent me to this thread. BTW, the person who made my origional boxes is electronicsuk (Matt).

    After reading that thread im not sure about DMX. I looked at assembler once then quickly made a break for the exit

  6. #6
    Join Date
    Jul 2003
    Location
    Colorado Springs
    Posts
    4,959


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by The Master View Post
    ... The plan wasnt to use these as DMX lights but how hard would that be?
    Very!

    Got paid to do it once.
    Came up with 1 18F as the front end receiving the DMX.
    And any number of slaves (8 per PIC).
    Up to 512 channels total. (lots of slaves, kinky)

    Unfortunately, it was for LED's (high powered one's, but still LED's)
    It'll be harder for A/C dimmers.

    .
    DT

  7. #7
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    DMX is out then! I dont want this to be any harder than it already is.

    Ive just been reading some of Matt's threads. I can see a few references to the boxes he made for me. Just to add, those boxes are still working perfect after something like 3 or 4 years. Nice job!

    Anyways. I cant seem to find much in those threads about the bits im stuck on. There is 1 thing that can be learned from them tho. Dont rivet triacs to anything! I had to replace one once without getting to the solder side of the PCB.

    This thread or more specificly the last post is quite interesting. Can someone tell me if the following is correct.
    There is a receive flag. Possibly whatever PBP uses as a boolean value. When serial data arrives at the chip this flag is set to true.

    RCREG returns the first byte from the serial buffer and removes it from the buffer. If this causes the buffer to be empty (that was the last byte) then the RX flag is set to false.

    I take it this uses the hardware UART thing to add data to a buffer (with no code)

  8. #8
    Join Date
    Jun 2007
    Location
    Mansfield, UK
    Posts
    697


    Did you find this post helpful? Yes | No

    Default

    Ive just found another thread with sample code of using UART and interrupts. It looks simple enough so im gonna test it out when i get back home (stupid work, ruining my day :P)

Similar Threads

  1. Trouble with PIC16F88 (chip hangs up)
    By nobner in forum mel PIC BASIC Pro
    Replies: 2
    Last Post: - 20th January 2009, 09:23
  2. Camera with PIC chip
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 1st July 2008, 14:28
  3. More info on L4620 liquid sensor chip
    By Nicmus in forum Documentation
    Replies: 4
    Last Post: - 1st June 2008, 23:03
  4. TV Display Chip
    By zadok in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 17th April 2008, 22:17
  5. chip selection aid
    By PICMAN in forum General
    Replies: 4
    Last Post: - 21st February 2005, 18:33

Members who have read this thread : 0

You do not have permission to view the list of names.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts