Subversion Repositories svnkaklik

Compare Revisions

No changes between revisions

Regard whitespace Rev 481 → Rev 482

/programy/C/PIC_C/mereni/teplomer/1wire.c
1,18 → 1,14
#define ONE_WIRE_PIN PIN_A3 // pro pristup k cidlu jsem zvolil
 
void onewire_reset()
 
 
 
{
output_low(ONE_WIRE_PIN);
delay_us(500);
delay_us(240);
output_float(ONE_WIRE_PIN);
delay_us(500);
delay_us(150);
output_float(ONE_WIRE_PIN);
}
 
 
void onewire_write(int data)
{
int count;
23,13 → 19,12
delay_us( 2 );
output_bit(ONE_WIRE_PIN, shift_right(&data,1,1));
 
delay_us( 60 );
delay_us( 40 );
output_float(ONE_WIRE_PIN);
delay_us( 2 );
}
}
 
 
int onewire_read()
{
int count, data;
41,7 → 36,7
output_float(ONE_WIRE_PIN);
delay_us( 8 );
shift_right(&data,1,input(ONE_WIRE_PIN));
delay_us( 120 );
delay_us(5);
}
 
return( data );
/programy/C/PIC_C/mereni/teplomer/main.c
1,31 → 1,20
#include "main.h"
 
 
#define LED_K1 PIN_A2 // anody segmentovek
#define LED_K2 PIN_A1
//#define LED_D1 PIN_A1 // katody segmentovek ///ted uz nepotreba
//#define LED_D2 PIN_A2
//#define LED_D3 PIN_A3
//#define LED_D4 PIN_A4
//#define LED_D5 PIN_A5
//#define LED_D6 PIN_A6
//#define LED_D7 PIN_A7
 
#include "1wire.c"
#include "ds1820.c"
 
 
void main()
{
long duty; // strida PWM
int temp; // zaokrouhlena teplota
//long duty; // strida PWM
int znak1; // hodnota jednotek
int znak2; // hodnota desitek
int znak; // zobrazovany znak
int i, n; // i pro for
int i, n, temp; // i pro for
int8 temp1, temp2;
signed int16 temp3;
 
 
 
setup_adc_ports(NO_ANALOGS|VSS_VDD); // parametry
setup_adc_ports(NO_ANALOGS|VSS_VDD);
setup_adc(ADC_OFF);
setup_spi(FALSE);
setup_timer_0(RTCC_INTERNAL|RTCC_DIV_1);
33,55 → 22,63
setup_timer_2(T2_DISABLED,0,1);
setup_comparator(NC_NC_NC_NC);
setup_vref(FALSE);
setup_oscillator(False);
 
while(TRUE)
{
temp = ds1820_read();
if (temp<10)
{ //pro teploty 0-10°C
znak1=temp;
znak2=0;
}
else
{
temp3 = make16(temp2, temp1);
temp=(int) (temp3/16);
znak2=(int) (temp/10); //vydelit deseti a zaokrouhlit dolu = desitky
znak1=temp-znak2*10; //jednotky rozdil teploty a desitek
for (n=0;n<=2;n++)
{
for (i=0;i<=2;i++) { //cyklus zobrazeni udaje
if (i==1) {
output_low(LED_K2); //dva bloky pro sepnuti aktivniho segmentu na 1
if (n==0){
onewire_reset();
onewire_write(0xCC);
onewire_write(0x44);
}
 
 
for (i=0;i<2;i++)
{ //cyklus zobrazeni udaje
if (i==0) {
output_low(LED_K2); //dva bloky pro sepnuti aktivniho segmentu na 1
output_high(LED_K1);
znak=znak1;
 
}
if (i==1) {
if (i==2) {
output_low(LED_K1);
if (n==0){
onewire_reset();
onewire_write(0xCC);
onewire_write(0xBE);
temp1 = onewire_read();
temp2 = onewire_read();
}
output_high(LED_K2);
znak=znak2;
}
if (znak==1) output_b(0b11110011); //blok if pro rozeznani zobrazeneho znaku
if (znak==2) output_b(0b01001001);
if (znak==3) output_b(0b01100001);
if (znak==4) output_b(0b00110011);
if (znak==5) output_b(0b00100101);
if (znak==6) output_b(0b00000101);
if (znak==7) output_b(0b11110001);
if (znak==8) output_b(0b00000001);
if (znak==9) output_b(0b00100001);
if (znak==0) output_b(0b10000001);
if (temp>=85)
{
output_high(LED_K1);
output_high(LED_K2);
output_b(0b00001101);
}
else
{
if (znak==1) output_b(0b11110010); //blok if pro rozeznani zobrazeneho znaku
if (znak==2) output_b(0b01001000);
if (znak==3) output_b(0b01100000);
if (znak==4) output_b(0b00110010);
if (znak==5) output_b(0b00100100);
if (znak==6) output_b(0b00000100);
if (znak==7) output_b(0b11110000);
if (znak==8) output_b(0b00000000);
if (znak==9) output_b(0b00100000);
if (znak==0) output_b(0b10000000);
}
Delay_ms(6);
}
 
Delay_ms(10);
}
 
 
// duty=104+(2,31*temperature); // .000416/(16*(1/4000000)) ....PWM presne podle helpu
// duty=104+(2,31*temp); // .000416/(16*(1/4000000)) ....PWM presne podle helpu
// set_pwm1_duty(duty);
}
 
 
 
 
}
/programy/C/PIC_C/mereni/teplomer/main.h
1,18 → 1,6
#include <16F88.h>
#device adc=8
#fuses NOWDT,INTRC_IO, NOPUT, NOMCLR, NOBROWNOUT, NOLVP, NOCPD, NOWRT, NODEBUG, NOPROTECT, NOFCMEN, NOIESO
#use delay(clock=4000000)
 
#FUSES NOWDT //No Watch Dog Timer
#FUSES INTRC_IO //Internal RC Osc, no CLKOUT
#FUSES NOPUT //No Power Up Timer
#FUSES MCLR //Master Clear pin enabled
#FUSES BROWNOUT //Reset when brownout detected
#FUSES LVP //Low Voltage Programming on B3(PIC16) or B5(PIC18)
#FUSES NOCPD //No EE protection
#FUSES NOWRT //Program memory not write protected
#FUSES NODEBUG //No Debug mode for ICD
#FUSES NOPROTECT //Code not protected from reading
#FUSES FCMEN //Fail-safe clock monitor enabled
#FUSES IESO //Internal External Switch Over mode enabled
 
#use delay(clock=4000000)
 
/programy/C/ix86/SID/sidd.kdevelop.pcs
Cannot display: file marked as a binary type.
svn:mime-type = application/octet-stream
Property changes:
Deleted: svn:mime-type
-application/octet-stream
\ No newline at end of property
/programy/C/ix86/SID/sidd.kdevses
File deleted
/programy/C/ix86/SID/sidd.kdevelop
15,8 → 15,8
<projectname>sidd</projectname>
<projectdirectory>.</projectdirectory>
<absoluteprojectpath>false</absoluteprojectpath>
<description></description>
<defaultencoding></defaultencoding>
<description/>
<defaultencoding/>
</general>
<kdevautoproject>
<general>
24,11 → 24,11
<useconfiguration>default</useconfiguration>
</general>
<run>
<mainprogram></mainprogram>
<mainprogram/>
<terminal>true</terminal>
<programargs></programargs>
<globaldebugarguments></globaldebugarguments>
<globalcwd></globalcwd>
<programargs/>
<globaldebugarguments/>
<globalcwd/>
<useglobalprogram>false</useglobalprogram>
<autocompile>true</autocompile>
<autoinstall>false</autoinstall>
53,20 → 53,20
</debug>
<default>
<envvars/>
<configargs></configargs>
<builddir></builddir>
<topsourcedir></topsourcedir>
<cppflags></cppflags>
<configargs/>
<builddir/>
<topsourcedir/>
<cppflags/>
<ldflags>-lfftw3 -lm</ldflags>
<ccompiler>kdevgccoptions</ccompiler>
<cxxcompiler>kdevgppoptions</cxxcompiler>
<f77compiler>kdevpgf77options</f77compiler>
<ccompilerbinary></ccompilerbinary>
<cxxcompilerbinary></cxxcompilerbinary>
<f77compilerbinary></f77compilerbinary>
<ccompilerbinary/>
<cxxcompilerbinary/>
<f77compilerbinary/>
<cflags>-Wall -O4 -ffast-math -DPENTIUM -Wall</cflags>
<cxxflags></cxxflags>
<f77flags></f77flags>
<cxxflags/>
<f77flags/>
</default>
</configurations>
<make>
78,7 → 78,7
<runmultiplejobs>false</runmultiplejobs>
<numberofjobs>1</numberofjobs>
<dontact>false</dontact>
<makebin></makebin>
<makebin/>
<prio>0</prio>
</make>
</kdevautoproject>
154,7 → 154,7
<projectdoc>
<docsystem>Doxygen Documentation Collection</docsystem>
<docurl>sidd.tag</docurl>
<usermanualurl></usermanualurl>
<usermanualurl/>
</projectdoc>
</kdevdocumentation>
<substmap>
208,7 → 208,7
<includePaths>.;</includePaths>
</codecompletion>
<creategettersetter>
<prefixGet></prefixGet>
<prefixGet/>
<prefixSet>set</prefixSet>
<prefixVariable>m_,_</prefixVariable>
<parameterName>theValue</parameterName>
230,11 → 230,11
</cppsupportpart>
<kdevdebugger>
<general>
<gdbpath></gdbpath>
<dbgshell></dbgshell>
<configGdbScript></configGdbScript>
<runShellScript></runShellScript>
<runGdbScript></runGdbScript>
<gdbpath/>
<dbgshell/>
<configGdbScript/>
<runShellScript/>
<runGdbScript/>
<breakonloadinglibs>true</breakonloadinglibs>
<separatetty>false</separatetty>
<floatingtoolbar>false</floatingtoolbar>
247,7 → 247,7
</display>
</kdevdebugger>
<ctagspart>
<customArguments></customArguments>
<customArguments/>
<customTagfilePath>/home/kaklik/projects/programy/C/i86x/SID/sidd/tags</customTagfilePath>
<activeTagsFiles/>
</ctagspart>
254,17 → 254,17
<dist>
<custom>false</custom>
<bzip>false</bzip>
<archname></archname>
<archname/>
<appname>sidd</appname>
<version>0.94</version>
<release>1</release>
<vendor>Universal Scientific Technologies</vendor>
<licence>GPL</licence>
<summary></summary>
<group></group>
<summary/>
<group/>
<packager>kaklik</packager>
<description></description>
<changelog></changelog>
<description/>
<changelog/>
<devpackage>false</devpackage>
<docspackage>false</docspackage>
<appicon>false</appicon>
273,6 → 273,6
<useRPM>false</useRPM>
<ftpkde>false</ftpkde>
<appskde>false</appskde>
<url></url>
<url/>
</dist>
</kdevelop>
/programy/C/ix86/SID/src/Makefile
77,9 → 77,9
AWK = gawk
CC = gcc
CCDEPMODE = depmode=gcc3
CFLAGS = -g -O2
CFLAGS = -Wall -O4 -ffast-math -DPENTIUM -Wall
CPP = gcc -E
CPPFLAGS = -Wall -O4 -ffast-math -DPENTIUM -Wall
CPPFLAGS =
CXX = g++
CXXCPP = g++ -E
CXXDEPMODE = depmode=gcc3
/programy/C/ix86/SID/src/sidd.c
438,8 → 438,8
c->powspec[ 0] = 0.0; // Zero the DC component
for( i=1; i<BINS; i++)
{
double t1 = c->fft_data[i,0];
double t2 = c->fft_data[i,1];
double t1 = c->fft_data[i][0];
double t2 = c->fft_data[i][1];
c->powspec[ i] = t1*t1 + t2*t2;
}