Click here to Skip to main content
15,885,309 members
Articles / Desktop Programming / MFC

A PIC C Code Wizard

Rate me:
Please Sign up or sign in to vote.
4.94/5 (27 votes)
5 May 2003CPOL5 min read 156.1K   7.9K   46  
Creates C code templates for PIC microcontrollers. The default templates are for use with the Hi-Tech (tm) PICC compiler.
#if !defined(AFX_ADC_H__5CF16096_8690_4C5C_890C_9B54819D7EC1__INCLUDED_)
#define AFX_ADC_H__5CF16096_8690_4C5C_890C_9B54819D7EC1__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ADC.h : header file
//

#define ADCCHANNELS_ALL		0xFF
#define ADCCHANNELS_0123567	0xF7
#define ADCCHANNELS_01234	0x1F
#define ADCCHANNELS_0124	0x17
#define ADCCHANNELS_013		0x0B
#define ADCCHANNELS_012		0x03
#define ADCCHANNELS_NONE	0x00
#define ADCCHANNELS_014567	0xF3
#define ADCCHANNELS_0123456	0x3F
#define ADCCHANNELS_01245	0x37
#define ADCCHANNELS_0145	0x33
#define ADCCHANNELS_014		0x13
#define ADCCHANNELS_01		0x03
#define ADCCHANNELS_0		0x01

/////////////////////////////////////////////////////////////////////////////
// CADC dialog

class CADC : public CPropertyPage
{
	DECLARE_DYNCREATE(CADC)

// Construction
public:
	CADC();
	~CADC();

// Dialog Data
	//{{AFX_DATA(CADC)
	enum { IDD = IDD_ADC };
	CComboBox	m_cADCON0Clock;
	CListBox	m_cADCSignals;
	CListBox	m_cADCChannel;
	CComboBox	m_cADCON1;
	int		m_iADCClock;
	CString	m_sADCSignalName;
	//}}AFX_DATA


// Overrides
	// ClassWizard generate virtual function overrides
	//{{AFX_VIRTUAL(CADC)
	public:
	virtual BOOL OnKillActive();
	virtual BOOL OnSetActive();
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

// Implementation
protected:
	BOOL GetADCON();
	SetADCClock( DWORD v_adcon0 );
	BOOL ValidateADCClock( DWORD v );
	UpdateADCChannelsList();
	BYTE m_ADCChannels;
	BOOL ValidateADCON1( DWORD v_adcon1, CString& s );
	// Generated message map functions
	//{{AFX_MSG(CADC)
	afx_msg void OnSelchangeAdcon1();
	afx_msg void OnAdcadd();
	afx_msg void OnUseadc();
	afx_msg void OnSelchangeAdcon0Clock();
	afx_msg void OnAdcremove();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()

};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_ADC_H__5CF16096_8690_4C5C_890C_9B54819D7EC1__INCLUDED_)

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Delphi
United States United States
Carlos Buelna works in the automotive industry.

Comments and Discussions