robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #25 on: November 09, 2007, 01:51:29 13:51 » |
|
Hello robban, Here is your code which can now be compiled using cc5x RED 3.2N. I've changed it somwhat, but still it is quite original code you posted. /* Crypto program. Let for instance putchar(c/c*2); and everything echoes back as garbage) echo characters, serial input/output for 16F84
Serial communication (RS232) Note that PIC16F84 doesn't even have an UART module! one start bit, one stop bit, 8 data bits, no parity = 10 bits Baudrate: 9600 baud ser_in RB1, ser_out RB0 */ #pragma config |= 0x3ff1 //(Fosc=XT, WDTE=off, PWRT=on, CP=off)
bit putchar(char); //function prototype char getchar(void); //function prototype
void main(void) { char c; PORTB = 0b00000001; TRISB = 0b01111110; while(1) { c = getchar(); //input one character if('r' == c) { putchar('\r'); //line feed putchar('\n'); //carriage return } else putchar(c); //echo the character ??? Return value not checked ??? } } /*Functions*/ bit putchar(char d_out) //sends one character. Baudrate = 9600 = 104.167 usec/bit { char bitCount, ti;
if ('\0' == d_out ){ return 0; } //refuse to send "end of string"
PORTB.0 = 0; //set startbit for(bitCount = 10; bitCount!=0; bitCount--) { //delay one bit 104 usec at 4 MHz (5+30*3-1+1+9=104)
// sam_des -- ??? Check this delay whether this is indeed 104uS @ 4MHz ??? ti = 30; do { nop(); }while(--ti);
Carry = 1; //stop bit d_out = rr(d_out); //rotate right trhough carry PORTB.0 = Carry; }
//??? sam_des -- Stop Bit ??? return 1; // all done }
char getchar(void) //receives one character {
//here we use a delay of 1.5 bit = 156 usec char d_in, bitCount, ti;
while(PORTB.1); //wait for startbit // sam_des -- ??? Added check for 10 bits in recved char ??? for( bitCount=10; bitCount!=0; bitCount-- ) { //delay 1.5 bit 156 usec @ 4 MHz (5+47*3-1+2+9=156)
// sam_des -- ??? Check if this delay is indeed 156uS @ 4MHz ??? ti = 47; do { }while(--ti);
Carry = PORTB.1; d_in = rr(d_in); // rotate carry right
ti = 30; do { nop(); }while(--ti); } return d_in; }
But I've no doubts that this code will NOT work. Whoever wrote this code, must have forgot half-way what he/she intended to do Some suggestions, Few of them, I've added into the code above. Others.. 1] putchar() - for() must do the delay for stop-bit also after 8 char bits. - Check the return value of putchar(). 2] getchar() - We must check each bit atleast 3-times during each bit-period & take it as 1 or 0 depending max. no. of 0s or 1s deteced. - Since Tx & Rx bauds are same(9600), bit period is same(104uS) in both cases. regards, sam_des Hi sam_des! I'll try to explain why the stop bit has to be a bit longer than the start bit(at least with a PIC without UART like the 16F84): Before idle(high), the startbit goes low to initialize transmission, then follows 8 bits with no parity(low bit). Then the stop bit goes high to end transmission(with the parity in between). If the transmission ended with a low bit with the same duration as a data bit the last bit could be lost. A UART could often be programmed to use the parity bit as a ninth data bit. If that's the case, communication halts if the ninth data bit is high(it indicate that transmission has ended and the message comes out as garbage) and everything crashes. As You might recall, the parity bit was used in the ancient times when mechanical punchcard was used. These gadgets easily jammed and that's why it's still used. chers robban
|
|
|
Logged
|
Code Warrior
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #26 on: November 09, 2007, 08:17:36 20:17 » |
|
I managed to compile it OK after abt. 2 hour in the RED-CC5X. Several files were missing, so it took some detective work.
|
|
|
Logged
|
Code Warrior
|
|
|
cjeffries1
Senior Member
Offline
Posts: 348
Thank You
-Given: 252
-Receive: 176
|
|
« Reply #27 on: November 10, 2007, 04:45:45 04:45 » |
|
I managed to compile it OK after abt. 2 hour in the RED-CC5X. Several files were missing, so it took some detective work.
Can you outline what you did and what the missing files were please?
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #28 on: November 10, 2007, 11:53:12 11:53 » |
|
Hi! These are the files needed to compile it in MPLAB. Don't worry about warning message 302(wrong bank bits) in the MPASM. According to MPLAB:s MPASM helpfile, You can suppress that(after a successful compilationand testing) by the command "errorlevel -302"(right after the PICxxx statement), but no success. Really, it doesn't matter, but clean outputs are nice. I suggest You study the linker script for future reference.
Good luck and return if You run into difficulties (the p16F873.inc is in the MPASM suite).
|
|
« Last Edit: November 21, 2007, 01:21:07 13:21 by robban »
|
Logged
|
Code Warrior
|
|
|
cjeffries1
Senior Member
Offline
Posts: 348
Thank You
-Given: 252
-Receive: 176
|
|
« Reply #29 on: November 10, 2007, 03:46:45 15:46 » |
|
Hi! These are the files needed ................Good luck and return if You run into difficulties (the p16F873.inc is in the MPASM suite).
I appreciate your response but at the risk of appearing dumb I don't see which files you are referring to. I suspect you have added an attachment and I think not everyone's browser can see attachments in this forum? If there is an "invisible" attachment, any chance you could put it on rapidshare with a link posted here? Also is this "FULL" version really a full version or does it have the same limitations as the "RED" version?
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #30 on: November 10, 2007, 04:57:00 16:57 » |
|
Here it is... http://rapidshare.com/files/68778304/ant-anl-0.03.rar.htmlNote that I use MPLAB 8 (just for trying out the new C32) and I'm using red-CC5X producing 14k of hex in this case. In all cases, if You can fit every C module in one, do it!
|
|
« Last Edit: November 10, 2007, 05:03:42 17:03 by robban »
|
Logged
|
Code Warrior
|
|
|
sonsivritwchen
Junior Member
Offline
Posts: 37
Thank You
-Given: 18
-Receive: 15
|
|
« Reply #31 on: November 20, 2007, 03:58:48 15:58 » |
|
Have anyone try the 24-bit integer math ?
|
|
|
Logged
|
|
|
|
mark1st
Newbie
Offline
Posts: 9
Thank You
-Given: 1
-Receive: 3
|
|
« Reply #32 on: November 21, 2007, 12:28:12 12:28 » |
|
Hi. Anyone here use cc5x compiler? It's worth? I'm looking for a good compiler (for a fuzzy project). I read all almost all topic about PIC compiler and I'm really confused.
mark
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #33 on: November 21, 2007, 12:53:00 12:53 » |
|
Have anyone try the 24-bit integer math ?
I will attache the code-ant.anl, a Project File, compiled inside MPLAB. Every code snippet and Math24lbc is there. So from this point of view, the 24-bit integer works fine. Revert If You run into problems
|
|
« Last Edit: November 21, 2007, 01:13:17 13:13 by robban »
|
Logged
|
Code Warrior
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #34 on: November 21, 2007, 01:19:12 13:19 » |
|
Hi. Anyone here use cc5x compiler? It's worth? I'm looking for a good compiler (for a fuzzy project). I read all almost all topic about PIC compiler and I'm really confused.
mark
This is the CC5X topic, read it through! Yr project may need another approach. Tell us what You really whant achieve and which MCU Y'r planning to use, along with other relevant info..
|
|
|
Logged
|
Code Warrior
|
|
|
bxac
Newbie
Muted
Offline
Posts: 18
Thank You
-Given: 4
-Receive: 2
|
|
« Reply #35 on: November 21, 2007, 03:09:07 15:09 » |
|
I've seen here references to the RED Edition of cc5x but I was not able to find it. Also, where can be found the full version of cc5x?
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #36 on: November 21, 2007, 03:31:40 15:31 » |
|
So far, no one has been able to find a .lincence file for the full or extended CC5X. I stared this topic in 2004 with the now absent member DAX(He really contributed a lot to this forum) You can use the (red)CC5x(Beta version) I submit here. It can handles single C-modules which produce 8K of words. I recently compiled a multi-module project producing 14K of words(Also included). The real limitations lies in it's lack of 32 Fixed point and float headers. Maybe someone can find them or transform them from other c_compilers(a tedious work Though)! Use with Yr.favourite ASCII-editor. For ease, copy all the binaries from MPASM SUITE(MASM,linker,MPCOD etc)
Good luck!
|
|
« Last Edit: November 21, 2007, 04:50:14 16:50 by robban »
|
Logged
|
Code Warrior
|
|
|
mark1st
Newbie
Offline
Posts: 9
Thank You
-Given: 1
-Receive: 3
|
|
« Reply #37 on: November 21, 2007, 04:40:53 16:40 » |
|
Try to make a fuzzy controller to drive a brushless motor in 4-quadrant (with PIC16F84): variable speed, variable load. Need to fit all in 2k regards, mark
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #38 on: November 21, 2007, 04:45:09 16:45 » |
|
That's a good idea. I check my code source and try to find something... I have looked through what I got, but no code for the 16F84(lack of CCP(PWM) module). There is a Timer 0, but at least to me I don't know how to implement what You have in mind.
If this is something Yr. teacher gave You, tell him You got to have the least a 16F628. For this MCU I think I can help You(inCC5X code). When it comes to variable(stable) load You have to ask somebody else. What I have in mind is a pulse-generator, a Legotype motor and a ICL7667-driver(everything is rather cheap). The pulsegenerator is divided in 255 steps and must be able to drive the motor in two directions. This is done by inverting the PWM-signal at earth. But - as I said - for the 16F84, I can't help You...
|
|
« Last Edit: November 23, 2007, 03:38:34 15:38 by robban »
|
Logged
|
Code Warrior
|
|
|
mark1st
Newbie
Offline
Posts: 9
Thank You
-Given: 1
-Receive: 3
|
|
« Reply #39 on: November 25, 2007, 12:02:22 12:02 » |
|
Ok. Thanks for advice regards, mark
|
|
|
Logged
|
|
|
|
kcsoft
Junior Member
Offline
Posts: 43
Thank You
-Given: 4
-Receive: 68
|
|
« Reply #40 on: September 01, 2008, 09:32:48 09:32 » |
|
As nobody could get a full version of cc5x (btw, i searched everywhere... noting), i tried myself to make one and after a few hours i succeed to patch cc5xtest (RED version) to generate all the labels in the asm file. You can get cc5xtest:http://www.bknd.com/cc5xtest.zip My patch:http://rapidshare.com/files/141450071/CC5X33APatch.7z.html MPASM from:www.microchip.com Better to use an IDE or a bat file to build your project. And its true:cc5x can generate 20-30% better code than hi-tech. Still, my favourite is hi-tech. Test results of the patch are welcomed.
|
|
|
Logged
|
|
|
|
robban
Senior Member
Offline
Posts: 265
Thank You
-Given: 34
-Receive: 38
Warrior
|
|
« Reply #41 on: September 01, 2008, 05:58:09 17:58 » |
|
I've must be missing something! The patch report success, but still the compiler is restricted to 8k code(which I can very well live with)
|
|
|
Logged
|
Code Warrior
|
|
|
kcsoft
Junior Member
Offline
Posts: 43
Thank You
-Given: 4
-Receive: 68
|
|
« Reply #42 on: September 01, 2008, 09:32:15 21:32 » |
|
Why do you need more than 8k program for a midrange pic since the biggest midrange has 8k of program memory?? Maybe its my mistake, i didnt give enough details about the patch: I quote from the bknd.com cc5x test edition: http://www.bknd.com/cc5x/downl-prof.shtml"The Test Edition is NOT a complete compiler. Up to 8k words of code can be generated, but NO hex file. The assembly file is MODIFIED (labels are not complete). This TEST edition supports 8, 16, 24 and 32 bit integers, fixed and floating point math, leanslice multitasking and FULL optimization (same as EXTENDED edition). This allows code development and conversion of existing applications to check code size." And what is does is putting all labels in the generated asm file(no hex file, must be compiled with MPASM) to "m000". The patch fixes this and all labels will have a name like m001,m002... So you have a full optimized compiler that generates a ready-to-compile asm file.
|
|
|
Logged
|
|
|
|
|
ahmed
Cracking Team
Senior Member
Offline
Posts: 316
Thank You
-Given: 101
-Receive: 594
|
|
« Reply #44 on: February 26, 2009, 03:34:44 03:34 » |
|
Patch is not working (Mismatch version)
|
|
|
Logged
|
|
|
|
ennio
Newbie
Offline
Posts: 15
Thank You
-Given: 4
-Receive: 15
|
|
« Reply #45 on: February 26, 2009, 06:58:28 06:58 » |
|
Patch is OK. Download the file cc5xtest.zip (D3CEEEDD9D50525FF50CDEB7D20C7C63 MD5 Hash) from http://www.bknd.com/cc5x/downl-prof.shtmlRegards ennio
|
|
|
Logged
|
|
|
|
sam_des
Senior Member
Offline
Posts: 256
Thank You
-Given: 128
-Receive: 151
|
|
« Reply #46 on: February 27, 2009, 07:45:10 19:45 » |
|
Hi, Please reupload, possible other than rapid/filefactory Also kcsoft, can you do the patch for cc8e too ?? Thanks in advance, sam_des
|
|
|
Logged
|
Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
|
|
|
sam_des
Senior Member
Offline
Posts: 256
Thank You
-Given: 128
-Receive: 151
|
|
« Reply #47 on: November 01, 2009, 11:10:32 11:10 » |
|
Hello, CC5X
The free edition supports up to 32768 instructions. The variable size is limited to 16 bit, signed and unsigned, plus 24 bit floating point. The generated code is compact, but full optimization is not available. The estimated code size of full optimization is stated.
...
Restrictions: The free edition can be used to generate code for all prototype, commercial and non-commercial systems without restrictions.
& CC8E
The free edition supports up to 128k (131072) instructions in a single C module. The variable size is limited to 16 bit, signed and unsigned, plus 24 bit floating point. The generated code is compact, but full optimization is not available. The estimated code size of full optimization is stated.
...
Restrictions: The free edition can be used to generate code for all prototype, commercial and non-commercial systems without restrictions
That's really great This covers entire code/ram space of 14-bit PIC ! As far as I remember, bad optimization is about code page/ram bank switching, nothing else and (I think you can turn off automatic bank/page updating & do it yourself manually). Even without full optimizations this is a good compiler written specifically for PIC. regards, sam_des
|
|
|
Logged
|
Never be afraid to do something new. Remember Amateurs built the Ark, Professionals built the Titanic !
|
|
|
tomywong
Active Member
Offline
Posts: 140
Thank You
-Given: 101
-Receive: 213
|
|
« Reply #48 on: November 04, 2009, 02:01:37 02:01 » |
|
Can someone upload cc5xtest.zip (v3.3H) ? Thx !
|
|
|
Logged
|
|
|
|
|
|