Which chip do i use?


Closed Thread
Results 1 to 40 of 78

Hybrid View

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

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

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

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

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


    Did you find this post helpful? Yes | No

    Default

    Ive just tried out Darrel's code again now im on this new chip and it compiled first time without me having to edit anything I used it to monitor the falling edge and i connected 2 diodes up. I did a quick test...

    Code:
    ToggleLED1:
    pause 5
    high PORTd.7
    pause 1
    low PORTd.7
    And the bulb lights up at half brightness WOO! Im just having a read through "Multiple Software PWM". Then ill have to figure out how to add serial to it but it looks like i can use his code for that too

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


    Did you find this post helpful? Yes | No

    Default

    Ive written some test code using DT's example

    Code:
    INCLUDE "DT_INTS-14.bas"     ; Base Interrupt System
    INCLUDE "ReEnterPBP.bas"     ; Include if using PBP interrupts
    
    resolution var byte
    x var byte
    
    ASM
    INT_LIST  macro    ; IntSource,        Label,  Type, ResetFlag?
            INT_Handler    INT_INT,  _ToggleLED1,   PBP,  yes
        endm
        INT_CREATE               ; Creates the interrupt processor
    ENDASM
    
    @   INT_ENABLE   INT_INT     ; enable external (INT) interrupts
    
    Main:
        for resolution=0 to 100
            pause 1
        next
        for resolution=100 to 0 step -1
            pause 1
        next
    GOTO Main
    
    '---[INT - interrupt handler]---------------------------------------------------
    ToggleLED1:
        for x=100 to 1 step -1
            if resolution=x then
                high portd.7
            endif
            pauseus 150
        next
        low portd.7
    @ INT_RETURN
    It works perfectly except the bulb fades out half way then pauses slightly then fades out completely. It also fades as its coming back in. Does anyone know why that is and how to fix it?

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


    Did you find this post helpful? Yes | No

    Default

    I think ive been looking at this the wrong way round. Ive had the multimeter on one of the boxes Matt made (8 triacs are riveted to the side so i cant see under the PCB). From what i can see the interrupt pin isnt connected at all. I think he has a main loop which just waits for a certain pin to go low (for the zero-crossing) then executes the bit to control how bright everything is. As for the serial input i think that is where the interrupt comes in. Either that or there is no interrupt at all and he checks that in the main loop too. Now its starting to sound simple

    For now im gonna use the same chips Matt used and see if i can make his circuit work on a breadboard. Then i can copy the hex code to the new chips. That gives me 8 outputs so ill need 2 chips per circuit but they are cheaper than 1 big one.

    1 thing i find weird about his circuit is that MCLR doesnt appear to be connected to anything :S

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