Page 1 of 2
Flowcode6 for PIC, DMX Slave component problems
Posted: Thu Feb 04, 2021 4:55 pm
by teeseetwo
Hello
This post is repeating a question I had about 5 years ago for a lighting control project. At the time I was having trouble getting the DMX Master and Slave to work correctly. Ultimately the project was for a DMX sender rather than receiver and I managed to get the Master component working well, and the project was successful. Now I do need to get the Slave working.
I am using a PIC16F628A chip (the same as I successfully used for the DMX Sender). After many tests and changes to the ReceiveData setups, it is clear that there is no detection of the DMX 'break' (ReceiveData should return a '1' but it never does). The DMX source is an industry standard test unit and works well driving various DMX devices. A scope shows the DMX 5v signal (after level shifting) inputting to the RX pin of the chip.
I would really like to sort this out. Your help would be very much appreciated.
Thanks
Tony
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Thu Feb 04, 2021 6:24 pm
by BenR
Hello,
Are you using Flowcode 6 or Flowcode 9? Can you post a project that demonstrates your setup and what your doing.
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Fri Feb 05, 2021 1:36 am
by teeseetwo
Thanks Ben for replying
I am using Flowcode 6 for PIC and the attached shows the very simple test program, with an LED on B3 showing the state of the ReceiveData return (x) and an LED on B0 as a flasher just to show the program is running and signal input is active (this of course stops as soon as the DMX input is removed).
I have also attached a pdf of the circuit which as you can see could not be simpler. I have shown it with a 20MHz xtal, but I have also tried it with the internal 4MHz oscillator. I also tried setting the Build/Project Options/Speed to different settings either side of 4MHz and a little lower than 20MHz. All without a glimmer of a pulse on B3 (LED or scope). I also tried by changing the wait times in ReceiveDataChain, also different numbers of channels in the Properties, up to 24. All with no success.
When I first started this project, I used something very similar to the Slave Example in the Help Files, but without any success, and then realised that without a return "1" from the ReceiveDataChain, there is no way it can work. Hence this very simple program just for testing.
Once the problem is solved, I will of course be adding GetDataChannel macros to actually decode the DMX signal.
I hope you can help
Thanks
Tony
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Fri Feb 05, 2021 1:57 am
by teeseetwo
Apologies, here is the corrected circuit of the test rig
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Mon Feb 08, 2021 1:09 pm
by BenR
Hello,
This forums is for v9 projects, v6 is now a legacy product and is no linger under support. Could you try loading the project into the free 30-day trial of Flowcode v9 and see if the problem has been resolved?
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Wed Feb 10, 2021 1:47 pm
by teeseetwo
Hi Ben
I installed the demo version of Flowcode 9 together with the Pic 16F compiler toolchain, but when I try to complie a very simple DMX receiver program (similar to the one I was trying to use in Flowcode 6), I get errors and the compliation stops....
^ (192) undefined identifier "MX_Conv_Var"
^ (196) struct/union required
(981) pointer required ^
(981) pointer required ^
DMX FC9.c: FCD_02571_TypeConversionsFree1__SetLong()
424: MX_Conv_Var.AsLong = FCL_VALUE;
^ (192) undefined identifier "MX_Conv_Var"
^ (196) struct/union required
DMX FC9.c: FCD_02571_TypeConversionsFree1__GetFloat()
439: FCR_RETVAL = MX_Conv_Var.AsFloat;
^ (192) undefined identifier "MX_Conv_Var"
(196) struct/union required ^
DMX FC9.c: FCD_02571_TypeConversionsFree1__GetLong()
456: FCR_RETVAL = MX_Conv_Var.AsLong;
^ (192) undefined identifier "MX_Conv_Var"
(196) struct/union required ^
I'm not sure what "MX_Conv_Var" is. Please help. I have attached the fcfx file.
Thanks
Tony
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Wed Feb 10, 2021 3:23 pm
by BenR
Hi Tony,
Thanks this bug should now be resolved. Go to Help -> Check for updates and there should be a fix for the COM Port component to will resolve this issue.
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Wed Feb 10, 2021 4:23 pm
by teeseetwo
Hi Ben
The file seems to compile ok except that it finishes much quicker than expected. In Flowcode 6, compiling virtually the same file takes much longer with a series of dots displayed until finally reaching the memory summary and "FINISHED". With this Flowode 9, it very quickly ends compilation, there are no error messages, although there are a couple of warnings...
C:\Users\TC\Desktop\Flowcode9 projects>C:\PROGRA~2\Flowcode\COMPIL~1\picv2\batch\..\pic\bin\xc8.exe --chip=16F628A "DMX FC9.c" --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32
C:\PROGRA~2\Flowcode\COMPIL~1\picv2\pic\bin\picc --chip=16F628A DMX FC9.c --MSGDISABLE=359,1273,1388 --FLOAT=32 --DOUBLE=32
Microchip MPLAB XC8 C Compiler V2.10
Build date: Jul 30 2019
Part Support Version: 2.10
Copyright (C) 2019 Microchip Technology Inc.
using updated 32-bit floating-point libraries; improved accuracy might increase code size
DMX FC9.c: 1173: (765) degenerate unsigned comparison (warning)
DMX FC9.c: 1173: (757) constant conditional branch (warning)
Memory Summary:
Program space used 17Fh ( 383) of 800h words ( 18.7%)
Data space used 4Dh ( 77) of E0h bytes ( 34.4%)
EEPROM space used 0h ( 0) of 80h bytes ( 0.0%)
Data stack space used 0h ( 0) of 50h bytes ( 0.0%)
Configuration bits used 1h ( 1) of 1h word (100.0%)
ID Location space used 0h ( 0) of 4h bytes ( 0.0%)
Compilation successful!
Launching the linker/assembler...
C:\Program Files (x86)\Flowcode\data\tools\DoNothing\DoNothing.exe
FINISHED
but unfortunately when I use the .hex file to program the chip (using a MiniPro TL866A programmer), it appears to complete the programming but ends with an error code:
ERROR! CONFIG:0x000001 Buf_Val:0xFF IC_Val:0x3F
It seems that the linker/assembler isn't starting for some reason so the .hex file is incomplete. Once again, I would appreciate your help on this.
Thanks
Tony
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Thu Feb 11, 2021 9:48 am
by BenR
Hi Tony,
Flowcode v9 uses a different C compiler to v6 and it is significantly quicker at compilation, XC8 vs BoostC. No linker is required for the compiler.
From the error "ERROR! CONFIG:0x000001 Buf_Val:0xFF IC_Val:0x3F" is sounds like your configuration settings may be incorrect. Use the Build -> Project Options window to check the configuration settings are correct for the device.
Hope this helps.
Re: Flowcode6 for PIC, DMX Slave component problems
Posted: Thu Feb 11, 2021 2:25 pm
by teeseetwo
Hi Ben
The reason why I thought the linker/assebler isn't running is the message...
Launching the linker/assembler...
C:\Program Files (x86)\Flowcode\data\tools\DoNothing\DoNothing.exe
As far as I can see all the Build settings are normal, and they are the same as in Flowcode 6, which never shows "DoNothing.exe" during the Compile process. I am entering the compiler by simply clicking "Compile to HEX..." which in FC6 generates a hex file (among others) which I can load into the programmer and always successfully program the chip with it.
In the FC9 Compiler Options, it lists a number of pickit options (pikit2, 3, 4) as well as a 2 others. In selecting any of them, clicking linker/assembler, it shows Location as " $(appdir)tools\DoNothing\DoNothing.exe" , which would seem to be the problem. I guess I have to navigate to the correct .exe, but in the folder "tools" (Flowcode/Data/tools) there's a long list but I'm not sure which one needs to be selected for the compilation to be successful. Please advise.
Thanks
Tony