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

    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?)

  2. #2
    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

  3. #3
    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 08:03.

  4. #4
    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

  5. #5
    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

  6. #6
    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)

  7. #7
    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)

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


    Did you find this post helpful? Yes | No

    Default

    Ive had a go at writing some code. This is just for the serial part. The idea is that if the chip gets chr(255) then it sets the next 16 bytes to the brightness levels (Later to be used to control the triacs).

    Code:
    datapos var byte
    newbyte var byte
    brightness var byte [15]
    
    trisc=%11111111
    spbrg=129
    rcsta=%10010000
    
    datapos=16
    
    loop:
    if pir1.5=1 then
        newbyte=rcreg
        if newbyte=255 then
            datapos=0
        else
            if datapos!=16 then
                brightness(datapos)=newbyte
                datapos=datapos+1
            endif
        endif
    endif
    goto loop
    I do have a few questions about it though. Can this only be used on a pin labeled RX? For this chip the pin labeled RX is RC7.

    An example i have says "RCSTA = %10010000 ' Enable serial port and continuous receive". What are we setting here? Are we telling it which pin is being used or is it just a standard value that means "on"?

    Is my code any good or should i scrap it and start again? :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, 10:23
  2. Camera with PIC chip
    By The Master in forum Off Topic
    Replies: 5
    Last Post: - 1st July 2008, 15:28
  3. More info on L4620 liquid sensor chip
    By Nicmus in forum Documentation
    Replies: 4
    Last Post: - 2nd June 2008, 00:03
  4. TV Display Chip
    By zadok in forum mel PIC BASIC Pro
    Replies: 19
    Last Post: - 17th April 2008, 23:17
  5. chip selection aid
    By PICMAN in forum General
    Replies: 4
    Last Post: - 21st February 2005, 19: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