Simple 4 channel DMX controller
Code:
'simple 4 channel DMX controller
'reads 4 potmeters to control 4 lights
'08-02-08 Kees Reedijk
@ DEVICE PIC16F88, MCLR_OFF, HS_OSC, WDT_ON, LVP_OFF, PWRT_ON
DEFINE OSC 20 ' 20MHZ crystal
DEFINE ADC_BITS 8 ' Set number of bits
DEFINE ADC_CLOCK 3 ' Set clock source
DEFINE ADC_SAMPLEUS 50 ' Set sampling time
DEFINE HSER_SPBRG 4 ' 250 KBaud
DEFINE HSER_CLROERR 1 ' Clear overflow automatically
RCSTA=%01010000 '9 bit data,usart disabled
TXSTA=%01100101 'Enable transmit, BRGH=1, 9 bit data
PORTA= %00000000
TRISA= %00001111
PORTB= %00100000
TRISB= %00000100
ANSEL= %00001111
CMCON= %00000111
DMX VAR PORTB.5 'DMX output to SN75176 bus driver
level1 VAR BYTE
level2 VAR BYTE
level3 VAR BYTE
level4 VAR BYTE
CLEAR
loop:
ADCIN 0,level1 'read level potmeters
ADCIN 1,level2
ADCIN 2,level3
ADCIN 3,level4
LOW DMX
PAUSEUS 100
HIGH DMX
PAUSEUS 12
RCSTA.7=1 'usart enabled
HSEROUT [0,level1,level2,level3,level4]
PAUSE 10
RCSTA.7=0 'usart disabled
GOTO loop
END
Re: Simple 4 channel DMX controller
This thread code looks goofed up any chances of including a txt file for the benefit of others.
Thanks.
Re: Simple 4 channel DMX controller
Re: Simple 4 channel DMX controller
Re: Simple 4 channel DMX controller
The vertical scroll bar is missing in the code area! So I can see only the few initial Lines of the code.
From what i understand reading the various Posts, it seems I am the only one with this problem.
Al.
Re: Simple 4 channel DMX controller
Is anyone else missing the scroll bars? I can see them.
Re: Simple 4 channel DMX controller
I see them fine.
maybe is your browser Al. Try some other, Opera for instance. I test it and seems a little faster that IE9.
Ioannis
Re: Simple 4 channel DMX controller
Quote:
maybe is your browser Al. Try some other, Opera for instance. I test it and seems a little faster that IE9.
Ok thanks. Problem seems to be with ipad browser, I can see it with firefox.
Al.
Re: Simple 4 channel DMX controller
Hi Al. assuming your iPad is like my iPhone, have you tried to "2 finger scroll" in the code window? On my phone I get no bars, but I can scroll the code windows using 2 fingers.
Re: Simple 4 channel DMX controller
Tank you Bert for the tip. 2 finger scroll in the code window works fine.
Cheers
Al.
Re: Simple 4 channel DMX controller
_Isthissoftwareworks the same wayhserin ?
Re: Simple 4 channel DMX controller
The DMX protocol uses 250k baud RS-485. There are some start pulses and such that need to happen. That what the HIGH/LOW DMX and pauses are doing. Here's an app note from Microchip that explains a bit more about it http://ww1.microchip.com/downloads/e...tes/01076A.pdf
Re: Simple 4 channel DMX controller
What is language? Basic?, C?, mikrobasic? Please help-me! thanks
Re: Simple 4 channel DMX controller
Depends which one you are talking about. The first post example is in PicBasic (check out www.melabs.com for software). The application note example for AN1076 is in assembly: http://www.microchip.com/stellent/id...pnote=en527825
Re: Simple 4 channel DMX controller
Re: Simple 4 channel DMX controller
personally... i hate the DMX protocol... but i'm sure their is a reason for it...
running at 250K baud is going to be fun for anyone new...
I recommend double buffering the data and using interrupts both for the USART and the ADC... ;)