Picbasic Pro Serial Communication Example
Pic. Basic Pro code, circuits, construction. Created 1. 7 October 2. Updated 7 August 2. Readings 9 number of samples to takeint median 0 median of the sorted samplesint reading. Picbasic Pro Manual' title='Picbasic Pro Manual' />Capability designed specifically for microEngineering Labs PICBASIC PRO. PICBasic code. For example. ITEAD Studio. Welcome. Login Sign up. PicBasic Pro Serial Communication r. Weather example ported to Particle platform. Picbasic Pro Examples' title='Picbasic Pro Examples' />PicbasicA collection of sample programs for use with the PicBasic Pro Compiler from MicroEngineering Labs. The debug statement in picBasic Pro is a limited version of asynchronous serial communication. This example shows the same value in all of these. Number counter for the sample array variables for subroutines byte i 0 byte j 0 byte position 0 int analog. Values9 function prototypes void bubble. Sort int average. FOTO/uk_MCS_Plus.jpg' alt='Picbasic Compiler Free Download' title='Picbasic Compiler Free Download' />Array void setup Serial. Number 0 reading. Number lt num. Readings reading. Number get the reading analog. Valuesreading. Number analog. Read0 increment the counter reading. Baixar O Cd Do Patati Patata Volta Ao Mundo. Number sort the array using a bubble sort bubble. Sort get the middle element median analog. Valuesnum. Readings 2 print the results print the array, nicely ASCII formatted Serial. Array for j 0 j lt num. Readings j Serial. Valuesj, DEC Serial. Serial. printrn average the array Serial. Average Serial. Array, DEC Serial. Median Serial. DEC Serial. Array int total 0 int average 0 for i 0 ilt num. Readings i total total analog. Valuesi average totalnum. Readings 1 return average void bubble. Sort int out, in, swapper forout0 out lt num. Readings out outer loop forinout inlt num. Readings in inner loop if analog. Valuesin analog. Valuesin1 out of order Set sampling time in u. STRISA 1. 11. 11. Set PORTA to all input. ADCON1 1. 00. 00. Set PORTA analog and right justify resultnum. Readings con 9 number of samples to takemedian var byte median of the sorted samplesreading. Number var byte counter for the sample array serial variables and constants tx var portc. Values var wordnum. Readings total var word average var word out var byte in var byte swapper var wordmain for reading. Number 0 to num. Readings 1 get the reading adcin 0,analog. Valuesreading. Number increment the counter reading. Number reading. Number 1 next sort the array using a bubble sort gosub bubble. Sort get the middle element median analog. Valuesnum. Readings 2 print the results print the array, nicely ASCII formatted serout. Array for j 0 to num. Readings 1 serout. DEC analog. Valuesj, next serout. Array serout. 2 tx, inv. Average, DEC average, 1. Median, DEC median, 1. GOTO MAIN average the values in the array average. Array total 0 average 0 for i 0 to num. Readings 1 total total analog. Valuesi next average totalnum. Readings. RETURNbubble. Sort for out 0 to num. Readings 2 outer loop for in out1 to num. Readings 1 inner loop if analog. Valuesout analog. Valuesin then out of orderContinue reading.