Jump to content

Recommended Posts

Hello there, <_<


I noticed in the examples section of the C2C site there is an example using a DS1821 to measure a temperature and a voice chip to output the temperature, plus warnings etc. It is labelled " This project (with circuit) created with ISD2560 record and playback chip, DS1821 temperature sensor, PIC16F84 with circuit for sightless Voice Termometer, fire and gas alarm system (by Ayhan Dayanik):". Unfortunately his email no longer exists so I cannot contact him directly.


I have tried to get my DS1821 to work using the ds1821.c and ds1821.h files and writing my own main program to check the temperature on every 256th interrupt and output it to a two digit (multiplexed) LED display. I'm using a 4511 chip to decode the BCD output from the PIC...


However, I have a problem. Its not working. I'm usually quite good at finding out why, but the errors are quite strange and I looked at the size of the assembled HEX file and it is 1.98KB. Obviously too big for the PIC16F84A. The example uses this chip, or the PIC16C84 version of it which also only has 1K of flash/rom memory (I think).


So, I am just wondering really how that example managed to get temperature measurements, and voice output all onto a 1K microprocessor using the C2C compiler... maybe I have the settings wrong after all this time of writing programs in it?


My options have set to maximise instruction optimising and I am calling the assembler using D:\MYDOCU~1\PIC\MPASMWIN.EXE /aINHX8M /p%target% /rHEX /w2 /q (which is default). I'm using the SourceBoost IDE with the C2C compiler (not BoostC).


Snipets of my code:





void on_timer0( void )
//TODO: add your timer 0 code here
temp = Temp_Measure();
if (porta & 4)
	clear_bit(porta, 2);
	set_bit(porta, 2);



void on_idle( void )
//TODO: add your idle code here
out1 = temp/10;
out2 = temp%10;
portb = out1 + 16;
portb = out2;


And thats pretty much it - much simpler than the example as I have no other interrupts (currently) and no voice output either! Its confuses me why this should be nearly 2K :rolleyes:


Any ideas would be nice if thats ok?


Many Thanks,

Link to post
Share on other sites



1.98k means < 1k instruction code. The hex file is in ASCII, so with each byte being represented by 2 bytes (0x3F = 3F in the files) and with instructions, line endings etc. u get a load of extra stuff which pads the file.


A project i am working on uses 633 bytes according to the compiler, and the hex file is 1.83k (according to windows)

Edited by pittuck
Link to post
Share on other sites

Ah ok, I never knew that! I just use ICProg to program the PIC and it seems to do it whatever the code size (although I don't think I have gone above twice the size I can actually use).


It is interesting to know this actually because I have a large project that uses two 8k PIC processors with HEX files 10.3K each, so actually I could go to 16K?


Anyway, I'll have another look through the code and try to find out where the problem is laying... I think it is because the interrupt routine takes longer to happen then for tmr0 to interrrupt again because of the 100ms delay.


Many Thanks, <_<

Link to post
Share on other sites
  • 9 months later...

Join the conversation

You are posting as a guest. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...