CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to support@ccsinfo.com

Hello, can someone please help me with DMX

 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
MiB1986



Joined: 05 Jun 2007
Posts: 3
Location: UK

View user's profile Send private message MSN Messenger

Hello, can someone please help me with DMX
PostPosted: Wed Jun 06, 2007 8:08 am     Reply with quote

Hiya,

I am looking to see if you can help, for several years now ive used picaxe, from www.picaxe.co.uk, and this is unfortunately too slow for DMX... as it works on token, but is great for things which do not require fast programs.

I would like to move onto DMX and this means upgrading into an intrupiter, i managed to make a DMX transmitter using one of there processors based upon a pic16f88 and it worked fine, i did this by slowing down for the break and then speeding up for the transmit. etc anywayz

I am completely new to this side of programming in extreme, ie i only know how to turn on and off a few LED using CCS complier and native pic micro,

but what i am after if possible is an example of a DMX reciever which is able to recieve 1 channel of DMX, obviously this channel id choose within the universe.

I intended to do this using a DIP switch, 8 way, and then simply reading portb say to a variable and then using that variable value as the DMX addres, would it work in your opinion?

Basically for now, is it possible to provide me with a DMX reciever code, and a DMX Transmitter code please.... as well as the processor information it will work on.

This code only has to work, and perhaps just store the DMX value recieved in a variable so later i can just use a compare statment and say if value is in the range of... do this etc...

I would perferbily like the resonator to be inside the processor for ease of use, although i do know they are not as acturate so an external is easily considered,

Please can you help, i understand and appreciate this is maybe a tall order.

If you are not able to provide full code, can you please tell me what devices would work with the code posted on the forum previously

I understand about the break, the header etc... i just cant get what i am used to using recieving and storing the data that fast.

Kind Regards....

Martyn
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 06, 2007 1:53 pm     Reply with quote

Microchip has an appnote (AN1076) for DMX512 protocol.
They have source code in ASM. Convert it to CCS.
http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1824&appnote=en527825
MiB1986



Joined: 05 Jun 2007
Posts: 3
Location: UK

View user's profile Send private message MSN Messenger

Hello, Can you help with DMX
PostPosted: Wed Jun 06, 2007 2:04 pm     Reply with quote

I have read it,

But how do i convert it?

Is there a way to convert it?


Thanks
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 06, 2007 2:23 pm     Reply with quote

If you know both CCS and ASM (even a little bit of ASM), then you
can convert it. For example, look at this file:
DMX512TrmtDemo.asm

The first part of it consists of CONFIG statements. In CCS, those
are settings are done with a #fuses statement.

Next come two #define statements:
Code:

#define T100US   .256-.100      
#define T60US   .256-.60

Translated to C:
Code:

#define T100US   (256 - 100)
#define T60US    (256 - 60)


Next there are several variable declarations:
Code:

CBLOCK   0x008
DmxTxState   
CountH      
CountL
TxBuffer: .512   
ENDC

Translated to C:
Code:

int8 DmxTxState;   
int8 CountH;      
int8 CountL;
int8 TxBuffer[512];   
 

It's possible that the two Count variables could be written as:
Code:
int16 Count;

I'd have to look at how it's used in the code.


Then the code starts:
Code:

    ORG 0x0000
Main
        rcall  InitTX   
        rcall  SetupSerial
        rcall  SetupADC      
MainLoop
        rcall  DMXTransmit
        rcall  CheckADC   
        goto   MainLoop


Translated to C:
Code:

void main()
{
InitTX();   
SetupSerial();
SetupADC();      

while(1)
  {
   DMXTransmit();
   CheckADC();   
  }


After that point it starts to require more work, but it could be done.
You need to have a good knowledge of CCS and at least some
knowledge of MPASM.
MiB1986



Joined: 05 Jun 2007
Posts: 3
Location: UK

View user's profile Send private message MSN Messenger

PostPosted: Wed Jun 06, 2007 3:01 pm     Reply with quote

unfortunately, i dont have these skills yet,

if i knew how to write in ASM i woud not bother with C, therefore am unable to covert it to C

Thanks for your help though and your time to reply...
PCM programmer



Joined: 06 Sep 2003
Posts: 21708

View user's profile Send private message

PostPosted: Wed Jun 06, 2007 3:19 pm     Reply with quote

You don't have to be able to write ASM. You just have to be able to
understand it enough (along with reading the comments) to get a good
idea of what's it's doing, and then write that same concept in CCS.
It doesn't require full ASM programmer skills to do the conversion.

But there's other code out there. This is found with Google.
http://ander.jp/blogarchives/dmxtoled.c

Here's code found with the CCS forum's search page. There may be more.
https://www.ccsinfo.com/forum/viewtopic.php?t=21092&postdays=0&postorder=asc&start=15

Forum search page:
http://www.ccsinfo.com/forum/search.php
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group