A discussion group for the PICMicro microcontroller. Also called the Microchip PIC, this list is dedicated to the use and abuse of this fine, simple, microcontroller. Close to topic posts are welcome, ie. general electronics.
|
Would like to ask if you guys mind giving me an idea on what are the instructions that I can "play" with if I intend to perform some comparison in my programme. Then, I will try to sort out how to make use of them? But of course it would be great if you don't mind giving me an example on how do I perform comparisons :) It seems that other microcontrollers, they have instructions such as Branch If Smaller Than, Branch If Bigger Than and so on. Just like the HC11. Am I right to say that I can "play" with BTSFC and BTFSS for comparison purposes? Any advice? Erm...any example? Please? :) Thank You... |
|
|
|
Only one way:
do a signed subtraction, then excamine the result ( negative-0-positive). You can use the BIT testing instructions in the way instructions you mention, but depending on processor there may be others....like BranchNeg, BranchZero..and so on. In the 16 series the skpz and skpnz and others could be used....nowhere near as simple as in many other controllers. devonsc wrote:
--
| |||
| |||
| |||
|
|
|
There is a rather complete series of 'Special Instruction Mnemonics' that perform various tests and branch-on-condition. These mnemonics often generate two instructions and help make the code more understandable. B Branch BC Branch on Carry BDC Branch on Digit Carry BNC Branch on No Carry BNDC Branch on No Digit Carry BNZ Branch on No Zero BZ Branch on Zero SETC Set Carry SETDC Set Digit Carry SETZ Set Zero SKPC Skip on Carry SKPDC Skip on Digit Carry SKPNC Skip on No Carry SKPNDC Skip on No Digit Carry SKPNZ Skip on Non Zero SKPZ Skip on Zero So, something like this will work: <some test that modifies the Z flag> BNZ Label ... ... ... Label Of course, you can always make up your own comparison and branch macros. This can be helpful for word sized operands. --- In , Eirik Karlsen <eikarlse@o...> wrote: > Only one way: > do a signed subtraction, then excamine the result ( > negative-0-positive). > You can use the BIT testing instructions in the way instructions you > mention, > but depending on processor there may be others....like BranchNeg, > BranchZero..and so on. > In the 16 series the skpz and skpnz and others could be used....nowhere > near as simple as > in many other controllers. > > devonsc wrote: > > > > > Would like to ask if you guys mind giving me an idea on what are the > > instructions that I can "play" with if I intend to perform some > > comparison in my programme. Then, I will try to sort out how to make > > use of them? But of course it would be great if you don't mind giving > > me an example on how do I perform comparisons :) It seems that other > > microcontrollers, they have instructions such as Branch If Smaller > > Than, Branch If Bigger Than and so on. Just like the HC11. > > > > Am I right to say that I can "play" with BTSFC and BTFSS for > > comparison purposes? Any advice? Erm...any example? Please? :) > > > > Thank You... > > > > > > > > > > > > to unsubscribe, go to http://www.yahoogroups.com and follow the > > instructions > > > > > > Yahoo! Groups Sponsor > ADVERTISEMENT > [click here] > > > > > ------------------------------------------------------------- -- > > Yahoo! Groups Links > > > > * To > > > -- > ******************************************* > VISIT MY HOME PAGE: > <http://home.online.no/~eikarlse/index.htm> > LAST UPDATED: 23/08/2003 > ******************************************* > Regards > Eirik Karlsen |
|
This is an extremely nice page about comparisons http://homepage.ntlworld.com/matthew.rowe/micros/virbook/logic.htm Peter van Hoof --- devonsc <> wrote: > Would like to ask if you guys mind giving me an idea > on what are the > instructions that I can "play" with if I intend to > perform some > comparison in my programme. Then, I will try to sort > out how to make > use of them? But of course it would be great if you > don't mind giving > me an example on how do I perform comparisons :) It > seems that other > microcontrollers, they have instructions such as > Branch If Smaller > Than, Branch If Bigger Than and so on. Just like the > HC11. > > Am I right to say that I can "play" with BTSFC and > BTFSS for > comparison purposes? Any advice? Erm...any example? > Please? :) > > Thank You... |
|
|
|
Hi, >Is UL Listing a consideration? CE mark? Very good point, although we will have our PIC based controller UL listed upon completion, along with the rest of the system. If anyone is curious about the application, our website can be found here. http://www.pondpcs.com Thanks, Eric --- In , "rtstofer" <rstofer@p...> wrote: > Is UL Listing a consideration? CE mark? > > --- In , "pondindustrial" > <pondindustrial@y...> wrote: > > > > Dwayne, > > > > Wow, you hit the nail on the head! > > > > I was under the impression PIC's were sluggish compared to PLC's. > To > > be honest, I got this impression after searching the web for PIC > > projects and found nothing more than trivial, hobby oriented stuff > > (not that there's anything wrong with hobby projects). I did run > some > > minor speed test of my own on a PIC16F877, I simply created a For > > Loop and incremented a variable to 50k, turned on a LED, paused > for > > one second, then turned the LED off, reset the counter to zero, > then > > did it over again, and again. The time between illuminations was > > quick considering; from there I couldn't understand why I didn't > find > > any processor demanding applications as a result of my Goggle > > searches… > > > > I did a quick tally of parts to recreate the functionality of the > ML- > > 1500 PLC combination (I/O cards etc.) using a PIC, it came out to > > less than $100 per controller, depending on quantity. This > included a > > two layer PCB at a quantity of 100 per order assuming we stuffed > and > > soldered the PCB's ourselves, although I didn't include labor. > > > > Does this sound correct? > > > > Thanks, Eric > > > > > > > > > > > > --- In , Dwayne Reid <dwayner@p...> wrote: > > > At 02:41 PM 12/16/2004, pondindustrial wrote: > > > > > > >Lets assume I will use any PIC that will do the job, will any > PIC > > do > > > >the job of a MicroLogix-1500, or is this out of the league of > any > > PIC > > > >in terms of computing power? > > > >Remember, I do not need the flexibility of a PLC's programming > or > > > >hardware features, this product will be produced once and > > duplicated > > > >many times. The goal is to save money in reproduction cost, yet > > allow > > > >the machine to function the same. Is a PIC with the proper > > supporting > > > >components up to the task? > > > > > > Absolutely YES. > > > > > > All the hard work is going to be in the compiler end of things - > > the > > > application running on the PC that is taking in your ladder > logic > > and > > > turning it into state machines that run on the PIC. > > > > > > Eliminate the ladder logic end of things and you have something > > that many > > > of us do on a regular basis: write your application in Assembler > or > > a > > > high-level language of your choice. > > > > > > I can give a specific example: the card set we use in some of > our > > > industrial process ovens is based on a PIC 16c73b running at 4 > MHz > > (1 > > > MIPS). The card set consists of several cards. > > > > > > The main card contains: > > > 7 user controllable SPDT relays, > > > output drivers for 6 more off-board relays, > > > 14- 8-bit a/d inputs, > > > 1- RS-232 port, > > > 1- custom 1-wire network port for communications between 62 > other > > card sets > > > 2- 8 position dip switches > > > 8 wire buss that goes off to the display card > > > 14 pin ribbon header for LCD display > > > power supply (24 Vac CT input) > > > > > > The optional daughter card that sits on top of the main card > adds > > 14 more > > > a/d inputs, 8 more SPDT relays and 2 more 8-position dip > switches. > > > > > > The display card contains 40 LEDs, 7- trinary switch inputs > > (connect to > > > SPDT center-off switches), a ribbon header that goes off to a > small > > numeric > > > display card with up to 3 digits of 7-segment displays and > another > > ribbon > > > header used to connect multiple multiple systems together. > > > > > > The software originally written for the customer's application > was > > done as > > > a background / foreground cooperative muli-tasking application. > > The > > > background task looks after all I/O processes: getting a/d > > readings, > > > controlling all the relays & LEDs, managing all the > > communications. The > > > background task uses about 200 us out of each 1024 us time > tick. > > The > > > remaining 800 us is available to the foreground tasks. > > > > > > Just for giggles and laughs, I took a completely different > > application > > > originally written for an A-B slc500 PLC system and implemented > it > > on our > > > card set. Each major task in the original ladder diagram was > > implemented > > > as a state machine running in the foreground on my PIC system. > I > > think I > > > wound up with 15 or 20 state machines all running concurrently. > > > > > > Because the background task took care of all the I/O, making the > > original > > > application run on this card set took surprisingly little > effort. > > One > > > interesting consequence was that the effective loop time went > from > > tens of > > > ms down to the 1.024 ms tick rate of the background task. In > other > > words, > > > not only was it MUCH less expensive to produce, it was faster! > > > > > > The down sides were several but minor: > > > > > > 1) end user can't change the code - the 16c73 is an OTP part. > Some > > might > > > see that as a benefit. > > > > > > 2) Your typical electrician can't write the code him/herself. > They > > can > > > write it in ladder form and send it to us but they don't usually > > work in > > > PIC assembler themselves. That means that quick changes in the > > field don't > > > happen unless we are out there with the unit. > > > > > > 3) Failures / mistakes happen. The end user can't call up their > > local A-B > > > distributor and just order in a new PLC when a conveyor line > breaks > > and > > > dumps a two ton block of metal on top of the control cabinet or > > when the > > > local electrician accidently drops one leg of 600V feeder onto a > > 17V limit > > > switch connection. (I've seen both of the those as well as > other > > > interesting failures). > > > > > > We dealt with failures by including spare cards with each > system. > > The cost > > > of a set of spare cards was much less than the cost of the > > equivalent A-B PLC. > > > > > > Hope this helps! > > > > > > dwayne > > > > > > -- > > > Dwayne Reid <dwayner@p...> > > > Trinity Electronics Systems Ltd Edmonton, AB, CANADA > > > (780) 489-3199 voice (780) 487-6397 fax > > > > > > Celebrating 20 years of Engineering Innovation (1984 - 2004) > > > .-. .-. .-. .-. .-. .-. .-. .-. .-. .- > > > `-' `-' `-' `-' `-' `-' `-' `-' `-' > > > Do NOT send unsolicited commercial email to this email address. > > > This message neither grants consent to receive unsolicited > > > commercial email nor is intended to solicit commercial email. |
|
Hi, >Is UL Listing a consideration? CE mark? Very good point, although we will have our PIC based controller UL listed upon completion, along with the rest of the system. If anyone is curious about the application, our website can be found here. http://www.pondpcs.com Thanks, Eric --- In , "rtstofer" <rstofer@p...> wrote: > Is UL Listing a consideration? CE mark? > > --- In , "pondindustrial" > <pondindustrial@y...> wrote: > > > > Dwayne, > > > > Wow, you hit the nail on the head! > > > > I was under the impression PIC's were sluggish compared to PLC's. > To > > be honest, I got this impression after searching the web for PIC > > projects and found nothing more than trivial, hobby oriented stuff > > (not that there's anything wrong with hobby projects). I did run > some > > minor speed test of my own on a PIC16F877, I simply created a For > > Loop and incremented a variable to 50k, turned on a LED, paused > for > > one second, then turned the LED off, reset the counter to zero, > then > > did it over again, and again. The time between illuminations was > > quick considering; from there I couldn't understand why I didn't > find > > any processor demanding applications as a result of my Goggle > > searches… > > > > I did a quick tally of parts to recreate the functionality of the > ML- > > 1500 PLC combination (I/O cards etc.) using a PIC, it came out to > > less than $100 per controller, depending on quantity. This > included a > > two layer PCB at a quantity of 100 per order assuming we stuffed > and > > soldered the PCB's ourselves, although I didn't include labor. > > > > Does this sound correct? > > > > Thanks, Eric > > > > > > > > > > > > --- In , Dwayne Reid <dwayner@p...> wrote: > > > At 02:41 PM 12/16/2004, pondindustrial wrote: > > > > > > >Lets assume I will use any PIC that will do the job, will any > PIC > > do > > > >the job of a MicroLogix-1500, or is this out of the league of > any > > PIC > > > >in terms of computing power? > > > >Remember, I do not need the flexibility of a PLC's programming > or > > > >hardware features, this product will be produced once and > > duplicated > > > >many times. The goal is to save money in reproduction cost, yet > > allow > > > >the machine to function the same. Is a PIC with the proper > > supporting > > > >components up to the task? > > > > > > Absolutely YES. > > > > > > All the hard work is going to be in the compiler end of things - > > the > > > application running on the PC that is taking in your ladder > logic > > and > > > turning it into state machines that run on the PIC. > > > > > > Eliminate the ladder logic end of things and you have something > > that many > > > of us do on a regular basis: write your application in Assembler > or > > a > > > high-level language of your choice. > > > > > > I can give a specific example: the card set we use in some of > our > > > industrial process ovens is based on a PIC 16c73b running at 4 > MHz > > (1 > > > MIPS). The card set consists of several cards. > > > > > > The main card contains: > > > 7 user controllable SPDT relays, > > > output drivers for 6 more off-board relays, > > > 14- 8-bit a/d inputs, > > > 1- RS-232 port, > > > 1- custom 1-wire network port for communications between 62 > other > > card sets > > > 2- 8 position dip switches > > > 8 wire buss that goes off to the display card > > > 14 pin ribbon header for LCD display > > > power supply (24 Vac CT input) > > > > > > The optional daughter card that sits on top of the main card > adds > > 14 more > > > a/d inputs, 8 more SPDT relays and 2 more 8-position dip > switches. > > > > > > The display card contains 40 LEDs, 7- trinary switch inputs > > (connect to > > > SPDT center-off switches), a ribbon header that goes off to a > small > > numeric > > > display card with up to 3 digits of 7-segment displays and > another > > ribbon > > > header used to connect multiple multiple systems together. > > > > > > The software originally written for the customer's application > was > > done as > > > a background / foreground cooperative muli-tasking application. > > The > > > background task looks after all I/O processes: getting a/d > > readings, > > > controlling all the relays & LEDs, managing all the > > communications. The > > > background task uses about 200 us out of each 1024 us time > tick. > > The > > > remaining 800 us is available to the foreground tasks. > > > > > > Just for giggles and laughs, I took a completely different > > application > > > originally written for an A-B slc500 PLC system and implemented > it > > on our > > > card set. Each major task in the original ladder diagram was > > implemented > > > as a state machine running in the foreground on my PIC system. > I > > think I > > > wound up with 15 or 20 state machines all running concurrently. > > > > > > Because the background task took care of all the I/O, making the > > original > > > application run on this card set took surprisingly little > effort. > > One > > > interesting consequence was that the effective loop time went > from > > tens of > > > ms down to the 1.024 ms tick rate of the background task. In > other > > words, > > > not only was it MUCH less expensive to produce, it was faster! > > > > > > The down sides were several but minor: > > > > > > 1) end user can't change the code - the 16c73 is an OTP part. > Some > > might > > > see that as a benefit. > > > > > > 2) Your typical electrician can't write the code him/herself. > They > > can > > > write it in ladder form and send it to us but they don't usually > > work in > > > PIC assembler themselves. That means that quick changes in the > > field don't > > > happen unless we are out there with the unit. > > > > > > 3) Failures / mistakes happen. The end user can't call up their > > local A-B > > > distributor and just order in a new PLC when a conveyor line > breaks > > and > > > dumps a two ton block of metal on top of the control cabinet or > > when the > > > local electrician accidently drops one leg of 600V feeder onto a > > 17V limit > > > switch connection. (I've seen both of the those as well as > other > > > interesting failures). > > > > > > We dealt with failures by including spare cards with each > system. > > The cost > > > of a set of spare cards was much less than the cost of the > > equivalent A-B PLC. > > > > > > Hope this helps! > > > > > > dwayne > > > > > > -- > > > Dwayne Reid <dwayner@p...> > > > Trinity Electronics Systems Ltd Edmonton, AB, CANADA > > > (780) 489-3199 voice (780) 487-6397 fax > > > > > > Celebrating 20 years of Engineering Innovation (1984 - 2004) > > > .-. .-. .-. .-. .-. .-. .-. .-. .-. .- > > > `-' `-' `-' `-' `-' `-' `-' `-' `-' > > > Do NOT send unsolicited commercial email to this email address. > > > This message neither grants consent to receive unsolicited > > > commercial email nor is intended to solicit commercial email. |
|
Hi, >Is UL Listing a consideration? CE mark? Very good point, although we will have our PIC based controller UL listed upon completion, along with the rest of the system. If anyone is curious about the application, our website can be found here. http://www.pondpcs.com Thanks, Eric --- In , "rtstofer" <rstofer@p...> wrote: > Is UL Listing a consideration? CE mark? > > --- In , "pondindustrial" > <pondindustrial@y...> wrote: > > > > Dwayne, > > > > Wow, you hit the nail on the head! > > > > I was under the impression PIC's were sluggish compared to PLC's. > To > > be honest, I got this impression after searching the web for PIC > > projects and found nothing more than trivial, hobby oriented stuff > > (not that there's anything wrong with hobby projects). I did run > some > > minor speed test of my own on a PIC16F877, I simply created a For > > Loop and incremented a variable to 50k, turned on a LED, paused > for > > one second, then turned the LED off, reset the counter to zero, > then > > did it over again, and again. The time between illuminations was > > quick considering; from there I couldn't understand why I didn't > find > > any processor demanding applications as a result of my Goggle > > searches… > > > > I did a quick tally of parts to recreate the functionality of the > ML- > > 1500 PLC combination (I/O cards etc.) using a PIC, it came out to > > less than $100 per controller, depending on quantity. This > included a > > two layer PCB at a quantity of 100 per order assuming we stuffed > and > > soldered the PCB's ourselves, although I didn't include labor. > > > > Does this sound correct? > > > > Thanks, Eric > > > > > > > > > > > > --- In , Dwayne Reid <dwayner@p...> wrote: > > > At 02:41 PM 12/16/2004, pondindustrial wrote: > > > > > > >Lets assume I will use any PIC that will do the job, will any > PIC > > do > > > >the job of a MicroLogix-1500, or is this out of the league of > any > > PIC > > > >in terms of computing power? > > > >Remember, I do not need the flexibility of a PLC's programming > or > > > >hardware features, this product will be produced once and > > duplicated > > > >many times. The goal is to save money in reproduction cost, yet > > allow > > > >the machine to function the same. Is a PIC with the proper > > supporting > > > >components up to the task? > > > > > > Absolutely YES. > > > > > > All the hard work is going to be in the compiler end of things - > > the > > > application running on the PC that is taking in your ladder > logic > > and > > > turning it into state machines that run on the PIC. > > > > > > Eliminate the ladder logic end of things and you have something > > that many > > > of us do on a regular basis: write your application in Assembler > or > > a > > > high-level language of your choice. > > > > > > I can give a specific example: the card set we use in some of > our > > > industrial process ovens is based on a PIC 16c73b running at 4 > MHz > > (1 > > > MIPS). The card set consists of several cards. > > > > > > The main card contains: > > > 7 user controllable SPDT relays, > > > output drivers for 6 more off-board relays, > > > 14- 8-bit a/d inputs, > > > 1- RS-232 port, > > > 1- custom 1-wire network port for communications between 62 > other > > card sets > > > 2- 8 position dip switches > > > 8 wire buss that goes off to the display card > > > 14 pin ribbon header for LCD display > > > power supply (24 Vac CT input) > > > > > > The optional daughter card that sits on top of the main card > adds > > 14 more > > > a/d inputs, 8 more SPDT relays and 2 more 8-position dip > switches. > > > > > > The display card contains 40 LEDs, 7- trinary switch inputs > > (connect to > > > SPDT center-off switches), a ribbon header that goes off to a > small > > numeric > > > display card with up to 3 digits of 7-segment displays and > another > > ribbon > > > header used to connect multiple multiple systems together. > > > > > > The software originally written for the customer's application > was > > done as > > > a background / foreground cooperative muli-tasking application. > > The > > > background task looks after all I/O processes: getting a/d > > readings, > > > controlling all the relays & LEDs, managing all the > > communications. The > > > background task uses about 200 us out of each 1024 us time > tick. > > The > > > remaining 800 us is available to the foreground tasks. > > > > > > Just for giggles and laughs, I took a completely different > > application > > > originally written for an A-B slc500 PLC system and implemented > it > > on our > > > card set. Each major task in the original ladder diagram was > > implemented > > > as a state machine running in the foreground on my PIC system. > I > > think I > > > wound up with 15 or 20 state machines all running concurrently. > > > > > > Because the background task took care of all the I/O, making the > > original > > > application run on this card set took surprisingly little > effort. > > One > > > interesting consequence was that the effective loop time went > from > > tens of > > > ms down to the 1.024 ms tick rate of the background task. In > other > > words, > > > not only was it MUCH less expensive to produce, it was faster! > > > > > > The down sides were several but minor: > > > > > > 1) end user can't change the code - the 16c73 is an OTP part. > Some > > might > > > see that as a benefit. > > > > > > 2) Your typical electrician can't write the code him/herself. > They > > can > > > write it in ladder form and send it to us but they don't usually > > work in > > > PIC assembler themselves. That means that quick changes in the > > field don't > > > happen unless we are out there with the unit. > > > > > > 3) Failures / mistakes happen. The end user can't call up their > > local A-B > > > distributor and just order in a new PLC when a conveyor line > breaks > > and > > > dumps a two ton block of metal on top of the control cabinet or > > when the > > > local electrician accidently drops one leg of 600V feeder onto a > > 17V limit > > > switch connection. (I've seen both of the those as well as > other > > > interesting failures). > > > > > > We dealt with failures by including spare cards with each > system. > > The cost > > > of a set of spare cards was much less than the cost of the > > equivalent A-B PLC. > > > > > > Hope this helps! > > > > > > dwayne > > > > > > -- > > > Dwayne Reid <dwayner@p...> > > > Trinity Electronics Systems Ltd Edmonton, AB, CANADA > > > (780) 489-3199 voice (780) 487-6397 fax > > > > > > Celebrating 20 years of Engineering Innovation (1984 - 2004) > > > .-. .-. .-. .-. .-. .-. .-. .-. .-. .- > > > `-' `-' `-' `-' `-' `-' `-' `-' `-' > > > Do NOT send unsolicited commercial email to this email address. > > > This message neither grants consent to receive unsolicited > > > commercial email nor is intended to solicit commercial email. |