PSMC PIC16F1783

Have you got the greatest 48 bit multiplier ever conceived? Prove it - post your code here.

Moderator: phalanx

Post Reply
imircea
Posts: 1
Joined: Mon Jan 14, 2013 3:30 am

PSMC PIC16F1783

Post by imircea » Mon Jan 14, 2013 3:34 am

Hi, i got some problem getting started with the PSMC of the PIC16F1783.
I tried also the example frm the datasheet and still got nothing. This is the code i'm using.

Tks for helping.

Code: Select all

 __CONFIG _CONFIG1, _FOSC_INTOSC & _WDTE_OFF & _MCLRE_OFF & _CP_OFF &  _CLKOUTEN_OFF 
 __CONFIG _CONFIG2, _PLLEN_ON & _LVP_OFF#include <p16f1783.inc>
 org 0x00
 BANKSEL PSMC1CON 
 MOVLW 0x02 ; set period 
 MOVWF PSMC1PRH 
 MOVLW 0x7F 
 MOVWF PSMC1PRL
 MOVLW 0x01 ; set duty cycle 
 MOVWF PSMC1DCH 
 MOVLW 0x3F 
 MOVWF PSMC1DCL 
 CLRF PSMC1PHH ; no phase offset 
 CLRF PSMC1PHL 
 MOVLW 0x01 ; PSMC clock=64 MHz 
 MOVWF PSMC1CLK ; output on A, normal polarity 
 BSF PSMC1STR0,P1STRA 
 BCF PSMC1POL, P1POLA 
 BSF PSMC1OEN, P1OEA ; set time base as source for all events 
 BSF PSMC1PRS, P1PRST 
 BSF PSMC1PHS, P1PHST 
 BSF PSMC1DCS, P1DCST ; enable PSMC in Single-Phase Mode ; this also loads steering and time buffers 
 MOVLW B'11000000' 
 MOVWF PSMC1CON 
 BANKSEL TRISC 
 BCF TRISC, 0
 end

Post Reply