config problem 16f819

For C and ASSEMBLY users to post questions and code snippets for programming in C and ASSEMBLY. And for any other C or ASM course related questions.

Moderators: Benj, Mods

Post Reply
bionunu
Posts: 5
Joined: Wed Feb 02, 2011 2:44 pm
Has thanked: 1 time
Contact:

config problem 16f819

Post by bionunu »

Hello

I am new with 16f819. I am using it to connect LCD at port B but for some reason its not working. So I first try to check all output pins using LEDs.
I am using V4
I have insert a c code osccon = 0x70;

then loop for ever
and made port A, B = 255

After burning it using TOP2007 Programmer, no led are glowing.

Can any body tell me where is the problem.

thank you.

Code: Select all

#define MX_PIC

//Defines for microcontroller
#define P16F819
#define MX_EE
#define MX_EE_TYPE2
#define MX_EE_SIZE 256
#define MX_SPI
#define MX_SPI_B
#define MX_SPI_SDI 1
#define MX_SPI_SDO 2
#define MX_SPI_SCK 4
#define MX_I2C
#define MX_I2C_B
#define MX_I2C_SDA 1
#define MX_I2C_SCL 4
#define MX_PWM
#define MX_PWM_CNT 1
#define MX_PWM_TRIS1 trisb
#define MX_PWM_1 3

//Functions
#define MX_CLK_SPEED 4000000
#ifdef _BOOSTC
#include <system.h>
#endif
#ifdef HI_TECH_C
#include <pic.h>
#endif

//Configuration data
#ifdef _BOOSTC
#pragma DATA 0x2007, 0x3f18
#endif
#ifdef HI_TECH_C
__CONFIG(0x3f18);
#endif

//Internal functions
#include "C:\Program Files\Matrix Multimedia\Flowcode V4\FCD\internals.h"

//Macro function declarations


//Variable declarations



//Macro implementations

void main()
{
	
	//Initialisation
	adcon1 = 0x07;


	//Interrupt initialisation code
	option_reg = 0xC0;


	//C Code
	//C Code:
	osccon = 0x60;


	//Loop
	//Loop: While 1
	while (1)
	{
		//Output
		//Output: 255 -> PORT A
		trisa = 0x00;
		porta = 255;


		//Output
		//Output: 255 -> PORT B
		trisb = 0x00;
		portb = 255;


	}


	mainendloop: goto mainendloop;
}

void MX_INTERRUPT_MACRO(void)
{
}
Attachments
Flowcode1.fcf
All Port HIGH
(7 KiB) Downloaded 378 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: config problem 16f819

Post by medelec35 »

Hi bionunu,
Your flowchart looks correct.
How about using your programmer, and reading your 16F819, then saving hex file and posting the saved hex file and the original hex file Flowcode produced on the forum. Also If your programmer shows the configuration value, Check it's correct value of 0x3f18
I can then compare the two.
This would make sure programmer is programming your target device correctly & hex file Flowcode produced are both OK.
That would only leave your hardware.
Are you using an LED eblock, or your own LED's? Maybe you can just measure the o/p pins of port A & B with a multimeter.

Martin
Martin

bionunu
Posts: 5
Joined: Wed Feb 02, 2011 2:44 pm
Has thanked: 1 time
Contact:

Re: config problem 16f819

Post by bionunu »

Hello Martin

Thanks for fast reply.

TOP2007 the programmer i used, its an universal programmer.
as u requested I have compile flowcode original HEX file.
and the programmer HEX file.
the programmer does not allow me to insert config bits directly.
i am using just LED to check the pins.


Image

Image

Image

Image

regards
bio
Attachments
programmer.HEX
programmer hex
(9.51 KiB) Downloaded 344 times
Flowcode1.hex
original hex
(504 Bytes) Downloaded 350 times

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: config problem 16f819

Post by medelec35 »

I have just loaded programmer.hex into my programmer, and it looks like the configuration is not correct. So this part is not wrote to the chip.
The configuration is correct within Flowcode1.hex file
Normally on programmers, there is an option to allow configuration to be added manually. Perhaps in a menu tucked away somewhere.

Martin
Martin

Post Reply