As far as hardware goes, you will need to get yourself a microcontroller. Either a 16f628a or 16f648a. You will also need a programmer (i personally use the pickit2 which costs around $30) The pickit2 is fantastic because you can program your chip while it is still in the circuit.
![]()
I tried pwm using the 16F628A, but I have encounterd some problem. I began my test using the following code: 'fpwm 38kHz dutycycle 50% #chip 16F628A, 20 #mem 224 #config CPOFF & DATACPOFF & PWRTEOFF & WDTOFF & LVPOFF & MCLREOFF & HSOSC dir PORTB b'11110111' 'PORTB.3 as output dir PORTA b'11111111' movlw 0x07 'comparator off movwf CMCON #define PWMFreq 38 #define PWMDuty 50 Main: InitPWM PWMOn loop1: goto loop1 'end I compiled the code (I got the assembler)and then I used mplab to simulate and see the output at PORTB.3. The output is a 38kHz square wave but the duty cycle is about 96%. So I tried to change the duty cycle changing the line: #define PWMDuty 50 for example into the line: #define PWMDuty 20 when I compiled the code in the dos window I got the message: Great Cow BASIC (0.9 17/9/2006) Compiling COMPILED.TXT. Type mismatch in module GCBASIC at address 0F8D:E0B4 Hit any key to return to system I realized that using other value for PWMDuty different from 50, I get always this type of error.
![]()
Hi Hugh, thank you for your answers, I try to visit the link but the page returns the follow message: An error has been encountered in accessing this page. Server: gcbasic.sourceforge.net 2. URL path: /newfiles. Error notes: File does not exist: /home/groups/g/gc/gcbasic/htdocs/newfiles.
Error type: 404 5. Request method: GET 6. Request query string: 7.
Time: 2006-10-01 08:54:26 PDT Reporting this problem: The problem you have encountered is with a project web site hosted by SourceForge.net. This issue should be reported to the SourceForge.net-hosted project (not to SourceForge.net).
If this is a severe or recurring/persistent problem, please do one of the following, and provide the error text (numbered 1 through 7, above): 1. Contact the project via their designated support resources. Contact the project administrators of this project via email (see the upper right-hand corner of the Project Summary page for their usernames) at [email protected] If you are a member of the project that maintains this web content, please refer to the Site Documentation regarding the project web service for further assistance.
Regards stefano.
Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |