USART+PWM Problem


Closed Thread
Results 1 to 40 of 44

Hybrid View

  1. #1
    Join Date
    May 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default dmx

    Dear JEC ;
    i looked to that site but all codes are in asm i need in PBP if i can make it better for me .really i want to make it by myself since a week and i know it is not so good to want code from peoples but really i dont know anything about the this commination in picbasicpro

    i read many documents and some code too but all in asm they explain everything in assembly language and when i want to make same thing in pbp then i have problem on interupts i think how can i solve it*?

    i have seen your code in the forum and copyed it for my devices but couldnt make it yet your code was for "'F88 @ 16 MHz" but i have f877 and 20 mhz osc the code that what i posted here it is your code .do you have some example for me in picbasicpro only for beginner i need only led intensty
    ( PWM ) nothing more i tryed it like this small code too before but also problem (i look for adres on dipsw)


    ' PIC16F876 + 20 MHz
    DEFINE OSC 20
    @ DEVICE HS_OSC

    DEFINE HSER_BITS 9
    DEFINE HSER_RCSTA 208
    DEFINE HSER_TXSTA 101
    DEFINE HSER_BAUD 250000
    DEFINE HSER_CLROERR 1

    SYMBOL IN =PORTC.0
    SYMBOL LED =PORTC.3 'LED

    INPUT IN

    TMP VAR WORD
    TMP1 VAR WORD
    VALORE VAR byte[8]
    BREAK VAR WORD
    NDMX VAR WORD
    DATI VAR WORD
    Clear

    ADCON0=0
    ADCON1=7

    OPTION_REG.7=0
    FOR TMP=0 TO 10
    TOGGLE LED
    PAUSE 200
    NEXT TMP
    LOW LED

    MAIN:

    NDMX=0
    NDMX.0=PORTA.1
    NDMX.1=PORTA.0
    NDMX.2=PORTB.7
    NDMX.3=PORTB.6
    NDMX.4=PORTB.5
    NDMX.5=PORTB.4
    NDMX.6=PORTB.3
    NDMX.7=PORTB.2
    NDMX.8=PORTB.1
    NDMX.9=PORTB.0

    ndmx = ndmx ^ %0000001111111111
    DATI=0
    PULSIN in,0,break

    IF BREAK>=44 THEN

    HSERIN 2000,MAIN,[tmp,tmp1]
    if tmp<>0 and tmp1<>0 then
    goto main
    endif

    FOR TMP=1 TO ndmx
    HSERIN 10,main,[tmp1]
    NEXT TMP

    FOR tmp=1 TO 64
    hserin 10,EXIT,[VALORE[tmp]]
    DATI=DATI+1
    NEXT TMP

    EXIT:
    FOR TMP=1 TO DATI
    VALORE[TMP]=VALORE[TMP]/4
    NEXT TMP

    '---------- here code that what i want to make for leds -----------------



    ENDIF


    GOTO MAIN

  2. #2
    T.Jackson's Avatar
    T.Jackson Guest


    Did you find this post helpful? Yes | No

    Post

    Yeah - I think you're trying to bite off a bit more than you can chew. Better to start with something a bit simpler and gradually progress your skills along the way.

  3. #3
    Join Date
    May 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Smile dmx

    :-) thanks

    i have made many projects with pic but dmx is not like "led open or close"
    it is different

    i wait answer only who knows about the dmx and who can help me to solve this problem and if you want i pay too

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by alex-x View Post
    :-) thanks

    i have made many projects with pic but dmx is not like "led open or close"
    it is different

    i wait answer only who knows about the dmx and who can help me to solve this problem and if you want i pay too
    It's not a matter of money...but if that's the way you want to go...so be it...
    Do you know what a good software developer charges for those services these days? It's not cheap for a good, reliable, bug-free product...
    (quite frankly neither do I...I've been paid for services before, but nothing with a contract, just a 'gentleman's agreement)
    Looks like this is one that gets fed the corn and never learns to farm...
    Last edited by skimask; - 16th May 2007 at 14:18.

  5. #5
    Join Date
    May 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default dmx

    it is ok friends , thanks for everything
    i decided to buy a small device for me
    Last edited by alex-x; - 16th May 2007 at 19:03. Reason: x

  6. #6
    Join Date
    Jun 2005
    Location
    Wisconsin
    Posts
    382


    Did you find this post helpful? Yes | No

    Default

    Jec, good find thanks for the info!

  7. #7
    Join Date
    May 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default 512

    @dynamoben

    Can you explain to me this code for 1 chanel?

    it was yours i have found it in the forum

    DimmerCount VAR WORD ; Location in DMX string
    DMXStartAddr VAR WORD ; DMX start address
    DMXStartCode VAR BYTE ; DMX Start code (Dimmer=0)
    Dummy VAR BYTE
    DMX_State VAR BYTE ; Stage of DMX reception

    Valid_Break CON 1
    Valid_SC CON 2
    Valid_Data CON 3

    Disable

    INTERRUPT_SUB:
    IF OERR Then
    CREN = 0
    CREN = 1 ; Clear Overrun Errors
    High Err_LED ; Notify user of overrun error
    DMX_State=0
    EndIF

    IF FERR Then
    FERR = 0
    DMX_State=Valid_Break
    Else
    GoSub RX_DMX_Data
    EndIF

    Dummy=RCREG ; Empty UART of junk data
    Resume

    RX_DMX_Data:
    IF DMX_State=Valid_Break Then
    HSerin 20,NoData,[DMXStartCode] ; Start code of 0 = dimmer data

    IF DMXStartCode=0 Then
    DMX_State=Valid_SC
    Else
    High Err_LED ; Notify user of Error in Start Code
    DMX_State=0
    EndIF
    EndIF

    IF DMX_State=Valid_SC Then
    For DimmerCount=0 TO DMXStartAddr; Count incoming data bytes (frames)
    Dummy=RCREG ; Read unwanted values
    Next DimmerCount
    DMX_State=Valid_Data
    EndIF

    IF DMX_State=Valid_Data Then
    HSerin 20,NoData,[STR DataBuffer\Number_Of_Channels]
    DMX_State=0
    EndIF

    IF DMX_State=0 Then
    Resume
    EndIF

    GoTo RX_DMX_Data

    NoData:
    DMX_State=0
    Resume

    Enable
    End

Similar Threads

  1. Variable PWM PIC18F2431
    By trr1985 in forum mel PIC BASIC Pro
    Replies: 7
    Last Post: - 12th June 2009, 06:03
  2. byte Tx w/ USART 16f876a problem
    By GargamelDigi in forum mel PIC BASIC
    Replies: 2
    Last Post: - 15th July 2008, 05:50
  3. USART Problem , but don't know where, in pc? or in PIC?
    By precision in forum mel PIC BASIC Pro
    Replies: 0
    Last Post: - 15th July 2007, 08:12
  4. problem with USART
    By leemin in forum Serial
    Replies: 4
    Last Post: - 11th December 2006, 17:56
  5. PWM problem CCP2 port
    By NL2TTL in forum mel PIC BASIC Pro
    Replies: 10
    Last Post: - 19th September 2006, 23:34

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