USART+PWM Problem


Closed Thread
Results 1 to 40 of 44

Hybrid View

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


    Did you find this post helpful? Yes | No

    Default

    5K$ (CAN Or even USD) is all you need to have a mine... IN PBP+ASM

    Therečs a tons of working ASM, C, and maybe BASIC routines here and there, the key is to understand, test, the protocol itself.

    I'm a DJ as well
    Steve

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

  2. #2
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    5K$ (CAN Or even USD) is all you need to have a mine... IN PBP+ASM
    Therečs a tons of working ASM, C, and maybe BASIC routines here and there, the key is to understand, test, the protocol itself.
    I'm a DJ as well
    I'll do it for 4K$ USD...none of that funny CAN stuff for me!

  3. #3
    Join Date
    May 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default ok

    it is ok friends i will work to make it bymyself and i wills end to this forum my code when it is ok

  4. #4
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by alex-x View Post
    it is ok friends i will work to make it bymyself and i wills end to this forum my code when it is ok
    I don't think anybody here is suggesting that you do it 'by yourself', but a bit of effort on your part wouldn't hurt the effort on anybody else's part...in other words...I can't speak for everybody, but, we'll help you as much as you help yourself...
    So get writing some code...(and put away all the sharp objects within reach )

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


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by skimask View Post
    ...(and put away all the sharp objects within reach )
    Look who's talking
    Steve

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

  6. #6
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by mister_e View Post
    Look who's talking
    My lab is in rework right now (remember the water damage awhile back?)...
    All I've got right now is some good smelling left over paint (wait 'till I post the pictures of the walls) and a bunch of wood that will become work benches...
    I've got lots of sharp objects and power tools within reach...but no electronics to work on...

  7. #7
    Join Date
    May 2007
    Posts
    16


    Did you find this post helpful? Yes | No

    Default usart

    @Mister_e
    @Skimask

    thanks for help me and look to my code please what is problem on it i have pic 16F877A and i use pbp 2,47 i have found this code int he forum and little designed it back for my Pic16F877A but it is not working i want to dim a led on portc1 (portc1and portc2 is pwm port on 877A pic) i want to dimming it but some probşlem on the code can you look and say what is my problem here?


    '----------------------------------------------------------------------
    INCLUDE "modedefs.bas"
    @ DEVICE HS_OSC
    @ DEVICE pic16F877A
    @ DEVICE pic16F877A, WDT_OFF
    @ DEVICE pic16F877A, PWRT_ON
    @ DEVICE pic16F877A, PROTECT_OFF
    @ DEVICE pic16F877A, BOD_OFF
    '----------------------------------------------------------------------
    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
    '----------------------------------------------------------------------
    TRISB=0
    TRISC=%10000000 ' portc.7 is RX input
    ADCON0=0
    ADCON1=7
    adresse_grada=2


    checkdmx:
    counter = 1
    pulsin portc.7,0,counter ' portc.7 is RX input
    if counter = 0 then
    idleflag = 1
    endif
    if counter < 40 then checkdmx

    dummy = RCREG
    dummy = RCREG
    SPBRG = 0
    TXSTA.2 = 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 'address1 is my target address

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

    newlevel1 = RCREG
    pwm portc.1,newlevel1 ,100 'i want dimming a LED on PORTC.1
    RCSTA.7 = 0 'turn off the USART
    goto checkdmx
    return

  8. #8
    skimask's Avatar
    skimask Guest


    Did you find this post helpful? Yes | No

    Default

    Quote Originally Posted by alex-x View Post
    @Mister_e
    @Skimask

    thanks for help me and look to my code please what is problem on it i have pic 16F877A and i use pbp 2,47 i have found this code int he forum and little designed it back for my Pic16F877A but it is not working i want to dim a led on portc1 (portc1and portc2 is pwm port on 877A pic) i want to dimming it but some probşlem on the code can you look and say what is my problem here?

    [code]
    checkdmx:
    .................................................. .........................
    pwm portc.1,newlevel1 ,100 'i want dimming a LED on PORTC.1
    .................................................. .........................
    goto checkdmx
    return
    PWM doesn't run in the background... When you hit a PWM command, that's what you get, one shot, one pulse of PWM, then you loop back and start checking for more DMX data input, which you probably missed because you were trying to do PWM in the first place, and while you are waiting for some DMX data, your LED is off because the PIC isn't executing a PWM command. See how it all ties in together to make a seemingly non-working version of the code?
    And what have you changed and/or tried to change in the code to make it work? Anything?
    What you want is some interrupt driven code...interrupt driven serial input, interrupt driven PWM (or a hardware module, whichever works for you).
    There's too much high speed stuff going on to be handled sequentially... Do a search for Instant Interrupts and Slow Speed Pulse Width Modulation. This code you've 'found' and keep copying probably isn't going to work for you in the end without knowing what's really going on in the first place and how to use interrupts.

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