USART+PWM Problem - Page 2


Closed Thread
Page 2 of 2 FirstFirst 12
Results 41 to 44 of 44
  1. #41
    Join Date
    May 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Exclamation dmx protocol

    Hi , i tryed this code but it is not working as a pwm for led
    where is the problem?

    is it here ? How can we use newlevel1 as a pwm value?

    "" pwm portc.2, newlevel1 ,100 'i want dimming a LED on PORTC.2"""




    ************************************************** *******
    ************************************************** *******

    DEFINE OSC 20
    DEFINE HSER_RCSTA 90h
    DEFINE HSER_TXSTA 24h
    DEFINE HSER_SPBRG 4
    DEFINE HSER_BAUD 250000
    DEFINE HSER_CLROERR 1



    counter VAR word
    idleflag VAR WORD
    dummy VAR WORD
    RCIF VAR byte
    startcode VAR WORD
    aminus VAR WORD
    adresse_grada VAR WORD
    x VAR WORD
    newlevel1 VAR WORD
    ADCON0=0
    ADCON1=7
    adresse_grada = 2


    checkdmx:

    counter = 1
    pulsin portc.7,0,counter
    if counter = 0 then
    idleflag = 1
    endif


    if counter < 40 then checkdmx

    dummy = RCREG
    dummy = RCREG
    SPBRG = 0
    TXSTA.2 = 0 'brgh = 0
    TXSTA.4 = 0
    RCSTA.7 = 1
    RCSTA.6 = 0
    RCSTA.4 = 0
    RCSTA.4 = 1

    while RCIF = 0:wend

    startcode = RCREG

    if startcode <> 0 then checkdmx

    aminus = adresse_grada - 1

    for x = 1 to aminus
    while RCIF = 0:WEND
    dummy = RCREG
    next x

    newlevel1 = RCREG
    pwm portc.2, newlevel1 ,100 ' HERE PROBLEM I THINK
    RCSTA.7 = 0

    goto checkdmx
    return

  2. #42
    Join Date
    Sep 2004
    Location
    montreal, canada
    Posts
    6,898


    Did you find this post helpful? Yes | No

    Default

    Hi and welcome on the forum.

    1. Those DEFINE's HSER_xxxx are not needed if you're not using HSERIN.

    2. it look like another DMX routine to me

    What's working and what doesn't?

    Do you understand the DMX protocol?

    How about your schematic, configuration fuses, PIC#?
    Steve

    It's not a bug, it's a random feature.
    There's no problem, only learning opportunities.

  3. #43
    Join Date
    May 2007
    Posts
    3


    Did you find this post helpful? Yes | No

    Smile dmx512

    Hi thanks yes im new in forum ,i was looking for dmx sample code in picbasicpro and came here
    i have forund that code in the forum here (There is Same Code İn All thread ) :-) is it so difficult in PBP ?
    and just tryed it but not working it is not real code ithink only sample

    ((( Schema is not so problem if you have any pic that which one has Usart (Rx) and (Hpwm) than it is ok and also u will need an for example SN75176A,SN75179B ( i use them in my controller ) i fu need more wpm chanels then u have to writte pwm code but if u need only 1 or 2 than you have to find a pic that which one has 2-3 hpwm ))) and 20 MHZ osc for 250kb baud rate

    I know everything about the dmx512 protocol ,
    http://www.dmx512-online.com/
    http://www.usitt.org/standards/DMX512.html

    it is 8n2 1 start 8 data and 2 stop , it is easy to receive it with usart config i know
    What is it, how does it work and how can we receive it and i use it also in my projects and i dont have any problem i use pic assembly in my projects ,you can find example code in microchip website also for dmx512 transmitter and receiver master - slave

    i just wanted to learn i have seen many code in forum about dmx512 and highspeed comm.. and some body said that has solved his dmx problem whit this code here in this adress in the forum
    ************************************************** *******
    http://www.picbasic.co.uk/forum/show...ghlight=dmx%2A

    ************************************************** *******
    Im not so good on the PicBasicPro i use assembly for my devices but when i look to code i didnt see any interupts and something also missing here
    how is it possible to use it for pwm ?
    did you make also any trying for dmx512 in pbp?
    i just want to learn how is the interupts here cause when i use it in assembly i have some interupts routin in code and i i can make dmx512 receive in pbp too then it can be fine for me cause it takes more time to make projects in assembly pbp and c is better for time if you have big projects
    When i look to exapmles also for rs485 they give it as a lowbaudrate(9400 and serin command to use) and PC to Pic not so high baudrate in examples what you found on the net..
    ************************************************** *******
    Maybe SomeBody Can develop This code here and can teach us how to use "hserin" command to decode chanel and make interrupts code.
    if anybody need in assembly i can help but here is pbp forum and when i look to forum many friends has problem in dmx512 protocol to decode it in pbp and also same code in everythread.

    There is many site about the dmx512 protocol but they just tell the protocol not any code example or schema you can learn it in 20 min that what is it but the problem is how to use it in code ...
    Last edited by dreamman; - 25th May 2007 at 00:32. Reason: x

  4. #44
    Join Date
    Dec 2008
    Posts
    8


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by alex-x View Post
    SSPWM ??

    how is it?
    MiBAM is much smoother (personal opinion). You can dim 24 pins with very little processing power. Send the value and it retains it until you change it.

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